Melatonin’s main job in the body is to regulate night and day cycles or sleep-wake cycles. Darkness causes the body to produce more melatonin, which signals the body to prepare for sleep. Light decreases melatonin production and signals the body to prepare for being awake. Some people who have trouble sleeping have low levels of melatonin. It is thought that adding melatonin from supplements might help them sleep.
For example, it is used for jet lag, for adjusting sleep-wake cycles in people whose daily work schedule changes (shift-work disorder), and for helping people establish a day and night cycle.