Magnesium supplements may help sleep quality. Taking this as a supplement may help improve the quality of sleep especially for those who have poor sleeping patterns. Research has shown that magnesium supplements can help to improve sleep. A 2012 double-blind randomised clinical trial found that daily magnesium supplements increased sleep time and efficiency. You can take magnesium supplements any time of day but you may find it helpful to take them at a consistent time, most choose to take them with a meal, in the morning or just before bed. Reference: Abbasi B, Kimiagar M et al. The effect of magnesium supplementation on primary insomnia in elderly: A double-blind, placebo-controlled clinical trial. J Res Med Sci. 2012 Dec; 17(12): 1161-9