Health · Protocol · ~12 min read

Sleep — architecture, melatonin, blue light, and the magnesium that fixes most of it.

Why sleep is the most under-prioritized health input in modern life, what the stages actually do, how blue light wrecks melatonin, and the protocol that consistently produces real sleep.

If fasting is the most consequential thing you can do during your waking hours, sleep is the more consequential thing you can do during the other third of your life — and most people are doing it badly. The CDC estimates roughly a third of American adults sleep less than seven hours per night. The functional medicine number is higher: when you start measuring actual sleep architecture rather than time in bed, the fraction of adults getting adequate restorative sleep is small.

The damage from chronic insufficient or fragmented sleep is broad and measurable: impaired insulin sensitivity within days, blunted immune function, elevated cortisol, suppressed testosterone and growth hormone, impaired memory consolidation, raised cardiovascular risk, and accelerated cognitive aging. Sleep is not a luxury. It is the maintenance shift, and skipping it means the maintenance doesn’t happen.

This article walks through what sleep architecture actually is, why melatonin matters more than the supplement aisle suggests, how blue light from screens wrecks the natural production of it, why magnesium is the single most underrated sleep supplement, the role of morning sunlight as a circadian anchor, and a protocol that consistently produces real sleep without medication.

What sleep is actually made of

Sleep is not one thing. It’s a structured sequence of stages that cycle roughly every 90 minutes through the night, and each stage does a different job. The two stages that matter most are deep sleep (slow-wave sleep, or N3) and REM (rapid eye movement).

Deep sleep is when the body does its physical restoration. Growth hormone surges. Tissues repair. The glymphatic system — the brain’s equivalent of the lymphatic system, only discovered in 2012 — flushes metabolic waste from neural tissue, including the amyloid-beta and tau proteins associated with Alzheimer’s disease. Deep sleep concentrates in the first third of the night. If you’re going to bed late, you’re cutting into the most physiologically critical part of the sleep cycle.

REM sleep is when the brain consolidates memory, integrates emotional experience, and runs the creative-problem-solving processing that produces the morning insight you didn’t have the night before. REM concentrates in the last third of the night and is what gets cut first when you sleep less than seven hours. Alcohol is a particular enemy of REM — it suppresses it for the first half of the night and produces a fragmented rebound in the second half. The drinker who passes out for eight hours has had a sleep that on architecture looks closer to five.

The implication: total time matters, but architecture matters more. A consistent seven-to-eight hours of unfragmented sleep, anchored to a stable bedtime, with the first cycle starting before midnight, produces a fundamentally different physiological output than ten hours of restless, screen-disrupted, wine-fragmented time in bed.

Melatonin and the circadian rhythm

The circadian rhythm is the body’s internal 24-hour clock, anchored primarily by light. When morning light hits your retina, the suprachiasmatic nucleus — a small cluster of cells in the hypothalamus — reads that light and sets the clock for the rest of the day. Cortisol peaks within the first hour of waking. The clock starts winding forward. Roughly twelve to fourteen hours later, in the absence of bright light, the pineal gland begins secreting melatonin. Melatonin is the chemical signal for sleep onset. Body temperature drops. Heart rate slows. Sleep follows.

That entire sequence depends on the light input. If you don’t get bright light in the morning, the cortisol anchor is weak. If you get bright light at night — especially the short-wavelength blue light that screens, LEDs, and overhead fixtures emit in abundance — you suppress melatonin and push the rhythm later. Charles Czeisler’s lab at Harvard has been documenting this for over a decade: two hours of evening iPad use suppresses melatonin by roughly 22% and delays its onset by about 90 minutes. That’s not a small effect. That’s the difference between falling asleep at 10 PM and falling asleep at 11:30, every night, forever.

The first move on sleep is fixing the light input. Bright light in the morning — ideally direct sunlight, ten to twenty minutes within the first hour of waking. Dim, warm light in the evening — no overhead fluorescents, no bright screens for the last hour or two before bed, blue-blocking glasses if you can’t avoid screens. A dark, cool bedroom. That sequence alone, without any supplements or medications, fixes the majority of sleep complaints in healthy people.

The magnesium fix

If you only do one supplemental thing for sleep, make it magnesium. The mineral is involved in over 300 enzymatic reactions in the body, including those that regulate GABA — the inhibitory neurotransmitter that lets the nervous system downshift into rest. It also regulates the parasympathetic side of the autonomic system and the production of melatonin itself.

The problem: modern diets are widely deficient in magnesium. The NHANES surveys consistently show roughly half of American adults consuming below the estimated average requirement, and the actual deficiency rate in tissues (rather than serum, which is a poor marker) is almost certainly higher. The classic symptoms — restless legs, nighttime cramps, anxious wakefulness around 3 AM, difficulty falling asleep despite being tired — map cleanly onto magnesium deficiency and resolve in most people within a week or two of supplementation.

The right form for sleep is magnesium glycinate (sometimes labeled bisglycinate) — magnesium bound to the amino acid glycine, which is itself calming and sleep-supportive. Magnesium citrate works but is more laxative-leaning. Magnesium oxide is cheap and poorly absorbed. Magnesium L-threonate is the form that crosses the blood-brain barrier most efficiently and has the strongest cognitive-effect literature, but it’s more expensive. Glycinate covers the common case at the right price.

Dose: 300-400 mg of elemental magnesium, taken 30-60 minutes before bed. (Note: this is elemental magnesium, not total compound weight — a label saying “Magnesium Glycinate 1,000 mg” usually delivers around 200 mg elemental.) Some people do better splitting the dose — half with dinner, half before bed. Dr. Mark Sircus has been making the case for transdermal magnesium for years — magnesium chloride spray applied to the skin — and for people with gut absorption issues, that route bypasses the digestive system entirely.

Melatonin supplementation — the low-dose case

Melatonin is one of the most over-dosed supplements on the market. The standard over-the-counter dose in the United States is 3-10 mg per pill. The physiological dose — the amount your body would produce on its own on a normal night — is roughly 0.1 to 0.3 mg. The supplement aisle is delivering 10 to 100 times the natural amount.

This matters because melatonin receptors downregulate with repeated high-dose exposure, which is the opposite of what you want for a long-term sleep aid. High-dose melatonin can also produce vivid, sometimes unsettling dreams; morning grogginess; and in some people, paradoxical sleep disturbance from the receptor disruption.

The smarter intervention, if you’re going to supplement at all, is the physiological dose: 0.3 to 0.5 mg, taken 30-45 minutes before bed. Life Extension sells a 300 mcg (0.3 mg) version that hits the right range; cutting a 1 mg tablet in halves or thirds works too. The goal is to nudge the natural signal, not to chemically override it.

That said: for most people, fixing the light input and adding magnesium produces enough sleep improvement that melatonin supplementation isn’t necessary. Save it for travel, shift-work adjustment, and the occasional jet-lag reset.

Morning sunlight as the master anchor

Andrew Huberman has put more public-attention weight on this than anyone, and the core protocol is simple: in the first hour after waking, get ten to thirty minutes of direct outdoor light exposure. Not through a window — window glass blocks the wavelengths that drive the circadian signal. Just outside, eyes open (no sunglasses), facing in the general direction of the sun without looking directly at it.

The mechanism is the cortisol anchor described above. Morning light sets the clock; the clock determines when melatonin rises that evening; melatonin rising on time is what produces clean sleep onset. Skip the morning light and the evening sleep signal arrives late, weak, or both. Get the morning light and the evening signal arrives on schedule.

This is free. It takes ten minutes. It is, in my experience and in the experience of nearly everyone who’s tried it consistently for two weeks, the single most underrated sleep intervention available. More effective than any supplement. More effective than most prescription sleep aids. And it works because it’s addressing the actual mechanism that all the supplements and medications are secondarily trying to manipulate.

The room

Bedroom optimization is straightforward and worth the effort. The target conditions:

Cool. 65 to 68 degrees Fahrenheit is the studied sweet spot for sleep architecture. Core body temperature has to drop for deep sleep to consolidate; a warm bedroom fights that drop and produces fragmented sleep.

Dark. Genuinely dark. Phone chargers, smoke detector LEDs, streetlights through the curtain — the cumulative light load that the average bedroom carries at night is enough to measurably suppress melatonin. Blackout curtains, electrical tape over indicator lights, no screens visible from the bed. A sleep mask if the room can’t be made dark enough.

Quiet. White noise or earplugs if your environment has irregular nighttime sound. The brain wakes preferentially to sound that varies from a baseline, so a constant white noise is often better than silence in an environment that isn’t fully soundproof.

Phone-free. The phone does not belong in the bedroom. There’s no version of this where the phone next to your bed is improving your sleep. Buy a $15 analog alarm clock if that’s your concern. The phone gets charged in another room.

The mouth-taping question

This one has moved from fringe to mainstream over the last few years, partly through the work of James Nestor in Breath. The argument: humans are obligate nasal breathers by design, and sleeping with an open mouth produces a cascade of problems — dry mouth, increased risk of cavities, snoring, disrupted CO2 chemistry, and reduced nitric oxide production (which the nasal passages contribute to). The intervention: a small piece of tape across the lips at night, encouraging nasal breathing as the default.

The evidence is still maturing. Anecdotally, people who tape consistently report deeper, more restful sleep, less snoring, and waking up without the dry mouth they didn’t realize was a sign of anything. The caveat: anyone with a structural nasal obstruction (deviated septum, severe allergies, polyps) or undiagnosed sleep apnea should not tape until those are addressed. Mouth breathing during sleep is often the body’s compensation for an airway issue, and removing the compensation without fixing the underlying problem is not a good plan.

For people with clear nasal passages and no apnea symptoms, mouth tape is a low-cost experiment worth running for a week or two.

What kills sleep

The shortlist of things that consistently destroy sleep, in roughly the order they affect most people:

Alcohol. One drink suppresses REM. Two drinks fragment the second half of the night. The drinker who feels they sleep better with a glass of wine is feeling faster onset, not better sleep. Architecture measurements show the opposite.

Late caffeine. Caffeine has a half-life of around five to six hours. Coffee at 2 PM means a quarter of the caffeine is still circulating at midnight. The right cutoff for most people is around noon — earlier than feels necessary, because most people don’t connect the afternoon coffee to the 3 AM wakeup.

Evening light. Already covered, but bears repeating because it’s the most overlooked sleep killer in modern life. Bright overhead lights and screens within two hours of bed are doing more damage than most people realize.

Late eating. A large meal within three hours of bed forces digestion to run during the period the body wants to be doing repair. Connects back to the fasting case: an early dinner is good sleep policy.

Inconsistent timing. The circadian system runs on regularity. Going to bed at 10 one night and 1 AM the next produces chronically shifted, lower-quality sleep even if the total hours look acceptable on average. The simplest single intervention — pick a bedtime, hold it within a 30-minute window every night, including weekends — produces measurable improvement within a week.

Where to start

A simple pattern, built from the interventions above: in bed by 10 PM most nights, lights out by 10:30, phone charging in another room. 300-400 mg of magnesium glycinate about an hour before bed, year-round. The bedroom kept around 66 degrees with blackout curtains and a sleep mask as the backup.

In the morning, within the first thirty minutes of waking, get outside — ten minutes of direct light, coffee in hand, even when it’s overcast (overcast outdoor light is still ten times brighter than indoor light, and the circadian effect works). No sunglasses for those ten minutes.

In the evening, the overhead lights go off as soon as it’s practical — lamps with warm bulbs after sunset, and blue-blocking glasses for any screen past 8 PM. No coffee after noon. Alcohol rare and never within four hours of bed.

The combination is unglamorous. None of these are interventions anyone can sell as a product. They’re light input, mineral repletion, and timing consistency. And they produce the kind of sleep that most adults forgot was available to them.

Products I’d recommend

Sleep is mostly behavior. The products below address the small fraction that supplementation actually helps with.

Pure Encapsulations Magnesium Glycinate is the form I’ve been buying for years. Clean ingredient list, well-absorbed glycinate form, and the brand has a reputation for third-party testing that justifies the premium price. 120 mg of elemental magnesium per capsule, so 2-3 capsules covers the sleep dose.

Doctor’s Best High Absorption Magnesium is the budget option that I’d still recommend. Magnesium glycinate / lysinate chelate, 100 mg elemental per tablet, and well-priced for the dose. The Costco-sized bottle lasts months.

Ra Optics Twilight Blue Blockers are the blue-blockers I keep on my nightstand for the evenings I’m on a screen past 8 PM. Properly tinted to block the wavelengths that actually suppress melatonin (not the lighter “computer glasses” that look almost clear — those don’t do enough). The orange tint takes adjusting to but is the price of an actual effect.

Hostage Tape is the mouth tape that’s become the default recommendation. Pre-cut, breathable, easy to remove without skin irritation. There are cheaper options (a roll of 3M Micropore tape from any pharmacy will do the job for a fraction of the price), but for people just starting, the pre-cut format is the lower-friction entry point.

Life Extension Melatonin 300 mcg is the low-dose option for the people who actually benefit from supplementation — travel, jet lag, occasional reset of a drifted schedule. 300 mcg sits in the physiological range; skip the 3-10 mg pills that dominate the supplement aisle.

The bottom line

Most sleep problems in otherwise healthy people are light problems, mineral problems, or timing problems — and all three are solvable without medication. Get morning sunlight within the first hour of waking. Dim and warm-shift the evening environment for the two hours before bed. Take magnesium glycinate at night. Hold a consistent bedtime within a 30-minute window. Keep the phone out of the bedroom. Keep the room cool and dark.

That stack is free or nearly so, takes a week or two to settle in, and produces the kind of restorative sleep that most adults have forgotten is the default state. The body wants to sleep well. Modern life is unusually good at preventing it. The fix is mostly getting out of the way.

Sources & further reading

Sleep architecture and consequences

  • Walker M. Why We Sleep: Unlocking the Power of Sleep and Dreams. Scribner, 2017.
  • Xie L, Kang H, Xu Q, et al. Sleep drives metabolite clearance from the adult brain. Science. 2013;342(6156):373-7. (Glymphatic system discovery)
  • Cappuccio FP, D'Elia L, Strazzullo P, Miller MA. Sleep duration and all-cause mortality: a systematic review and meta-analysis of prospective studies. Sleep. 2010;33(5):585-92.

Light, melatonin, and circadian rhythm

  • Chang AM, Aeschbach D, Duffy JF, Czeisler CA. Evening use of light-emitting eReaders negatively affects sleep, circadian timing, and next-morning alertness. PNAS. 2015;112(4):1232-7.
  • Wright KP Jr, McHill AW, Birks BR, et al. Entrainment of the human circadian clock to the natural light-dark cycle. Current Biology. 2013;23(16):1554-8.
  • Burgess HJ, Revell VL, Eastman CI. A three-pulse phase response curve to three milligrams of melatonin in humans. Journal of Physiology. 2008;586(2):639-47.

Magnesium and sleep

  • Abbasi B, Kimiagar M, Sadeghniiat K, et al. The effect of magnesium supplementation on primary insomnia in elderly: a double-blind placebo-controlled clinical trial. Journal of Research in Medical Sciences. 2012;17(12):1161-9.
  • Sircus M. Transdermal Magnesium Therapy. iUniverse, 2011.
  • Rosanoff A, Weaver CM, Rude RK. Suboptimal magnesium status in the United States: are the health consequences underestimated? Nutrition Reviews. 2012;70(3):153-64.

Breath and nasal breathing

  • Nestor J. Breath: The New Science of a Lost Art. Riverhead Books, 2020.

Other authority figures

  • Huberman A. Public protocols on morning sunlight, evening light hygiene, and circadian anchoring — Huberman Lab podcast.
  • Berg E. Public commentary on potassium, magnesium, and sleep — YouTube channel.