Magnesium helps to relax your muscles. Melatonin helps to regulate your sleep-wake cycles. You get twice the sleep aid by taking both. Both are is important, the mineral, magnesium, and the hormone, melatonin. Your body craves both and your sleep depends upon them.