What it's normally used for
Melatonin is a natural hormone that your body's pineal gland makes. This is a tiny little pea-sized gland located right above the middle of the brain. In the day the pineal is inactive, and then when the sun goes down and darkness comes, the pineal is "turned on" by the suprachiasmatic nucleus (SCN) and starts to create melatonin, which get's released into the blood. Usually, this occurs at around 9 pm. Because of this, melatonin levels in the blood increase sharply so you start to feel less alert, making you want to sleep. Melatonin levels in the blood stay high for about 12 hours - all night long - until the light of a new day comes, and they then fall back down to low daytime levels by about 9 am. Daytime levels of melatonin are hardly detectable at all.
What it does for Lucid Dreaming
Melatonin is known for generating vivid dreams. In the word of one dreamer, 'You will never dream as vividly as you do on melatonin.'
Melatonin contributes to the quality and quantity of REM sleep, which is when most dreams take place. Taking extra melatonin can kick our REM cycle into hyperdrive, giving us longer, richer, more memorable dreams.
High levels of Melatonin can generate more vivid dreams and provide some high quality sleep, while lower levels make you have trouble sleeping, insomnia, and poor quality dreams.