One study of older adults with insomnia found that magnesium supplementation at a dose of 500 milligrams daily for eight weeks helped them fall asleep faster, stay asleep longer, reduced nighttime awakenings, and increased their levels of naturally circulating melatonin.