If you've tried magnesium for sleep, you were on the right track. Magnesium helps your nervous system relax, and many people with stress-driven sleep problems are low in it.
The problem is that most magnesium on drugstore shelves is magnesium oxide. It's the cheapest form, and your body barely absorbs it. One study found only about 4% of it gets absorbed (Firoz & Graber, 2001). Most of the rest stays in your gut, which is why oxide is better known as a laxative than a sleep aid.
Better-absorbed forms work differently. Magnesium glycinate, for example, also delivers glycine, an amino acid shown to improve sleep quality (Yamadera et al., 2007).
But even the best single form only handles one part of the problem. It helps you relax. It doesn't do enough on its own to keep your stress alarm quiet at 3 a.m.
To get through the whole night, you need the right magnesium (in fact, several forms, since each one is absorbed and used a little differently), plus ingredients that support how your body handles stress overnight.