James F. Balch, M.D. writes: "A lack of the nutrients magnesium and calcium will cause you to wake up after a few hours and not be able to return to sleep." Magnesium is also beneficial for bone health and heart health. Melatonin is a hormone produced by the pineal gland in the brain. According to WebMD, melatonin side effects may include headache, depression, daytime sleepiness, dizziness, stomach cramps and irritability.