Melatonin is a hormone produced by the pineal gland in the brain that regulates the sleep-wake cycle. It is often called the 'sleep hormone' because rising melatonin levels signal to the body that it's time to sleep.
Melatonin production is controlled by light exposure. As darkness falls, the pineal gland increases melatonin production, promoting drowsiness. In the morning, light exposure suppresses melatonin, promoting wakefulness. This is why the hormone is central to the circadian rhythm — the body's internal 24-hour clock.
In the UK, melatonin is a prescription-only medicine (unlike the US, where it's sold over the counter). It's primarily prescribed for certain sleep disorders and jet lag. Always consult a GP rather than self-medicating.