Melatonin is a hormone that your brain produces in response to darkness. It helps with the timing of your circadian rhythms (24-hour internal clock) and with sleep. Being exposed to light at night can block melatonin production.