Magnesium CAN help you sleep.
Magnesium is not a sleep aid nor does it promote drowsiness, but if your body is lacking adequate levels of magnesium, your sleepless nights may be resolved with increased magnesium intake.
Sleepless Nights? Magnesium Deficiency May Be to Blame
Sleep disturbances and insomnia are caused by a variety of factors including a magnesium deficiency. Research has indicated that magnesium plays an important role in the sleep process and that those with a deficiency demonstrate a significant increase in wakefulness, light and disorganized sleep, and have a harder time falling asleep with lower sleep quality. In several studies, sleep patterns returned to normal when magnesium levels were balanced. 
Magnesium Supplements as a Sleep Aid
Though increasing your magnesium intake may be the resolution to your sleep problems, taking supplements is probably not a good idea unless specifically recommended by your physician.
The caveat to using pharmacological magnesium whether in supplements or other forms is that is carries with it the risk of side effects if taken in excess. Side effects can include upset stomach, nausea, vomiting, and diarrhea. More serious side effects of extreme doses can include low blood pressure, irregular heartbeat, slowed breathing, confusion, and even coma and death. 
Magnesium supplements can also interact with other medications such as aminoglycoside antibiotics, quinolone antibiotics, tetracycline antibiotics, bisphosphonates, medications for high blood pressure, muscle relaxants, and water pills. 
Eat More Spinach-Sleep Better at Night
If your sleep issues are connected to low levels of magnesium, the best way to resolve the deficiency is through diet. In light of the fact that nearly 75% of Americans do not get enough magnesium in their diets, a logical, healthy first line of defense against those sleepless nights might be the increase of your dietary intake of magnesium.  You can easily increase your dietary levels of magnesium by eating a varied diet that includes plenty of legumes, nuts, whole grains, and vegetables. A few foods that are high in magnesium are wheat bran, almonds, spinach, raison bran, and cashews. 
And unlike pharmacological magnesium, the great thing about eating more magnesium rich foods is that there are no side effects.
Milk as a Sleep Aid?
As science has evolved over the decades many folk-remedies passed down through the generations have been proven ineffective. The traditional notion that warm milk before bedtime will help promote sleep may actually be valid. Milk contains 37 mg of magnesium, but also packs tryptophan, which the body uses to produce serotonin, a chemical in the body believed to be associated with sleep.