Three things have to line up for good sleep: a body clock that says it's night, enough sleep pressure built up over the day, and a body that can cool down and switch off. Most bad nights come from one of the three being off, and most of the fixes are free.
The short list
Ranked by how much each one moves
Get up at the same time every dayA fixed wake time anchors the whole clock. It's the core of the best insomnia treatment.why ↓
Bright light in the morning, dim light at nightDaylight sets the clock. Bright evening light pushes melatonin later.why ↓
No caffeine after noonCoffee 6 hours before bed still cost people about an hour of sleep.why ↓
No alcohol in the 3 hours before bedIt knocks you out, then wrecks the second half of the night.why ↓
Fix your breathing at nightSnoring and sleep apnoea fragment sleep hundreds of times a night without waking you.why ↓
Keep the bedroom cool and darkYour core temperature has to drop for deep sleep to start.why ↓
Move hard during the dayExercise builds sleep pressure and deepens slow-wave sleep.why ↓
Glycine and magnesium at nightGlycine helps you cool down. Magnesium calms nerve firing.why ↓
Strong human evidenceSome human dataMostly animal / cell
A sleep day
Same wake time, then outside for 10–30 minutes
Last coffee before noon
A hard workout or a long walk, ideally before evening
Dinner 2–3 hours before bed, no alcohol after it
Lamps, not overhead lights, after dark. Room at about 65 °F (18 °C).
¾ tsp glycine (3 g) and 200–400 mg magnesium glycinate an hour before bed
Watch out
Loud snoring, gasping or waking unrefreshed means getting checked for sleep apnoea
OTC sleep aids (diphenhydramine, doxylamine) are anticholinergic. Heavy long-term use tracks with dementia.
Melatonin pills often don't contain what the label says
Don't stop prescribed sleeping pills abruptly
How it fits together
Sleep is gated by two systems. The body clock decides when you can sleep, and runs on light. Sleep pressure decides how much you need, and comes from adenosine building up in the brain the longer you're awake. Both have to say "now" at the same time. Then the body has to actually let go: core temperature falls, heart rate drops, the stress system goes quiet, and the airway has to stay open.
A fixed wake time and daylight line up all three
↓↓↓
1 · The clock
When you can sleep
Light on the eyes sets a 24-hour clock. Melatonin rises a few hours after dark, but only if the evening is actually dim.
Deep, unbroken sleep: clock and pressure agree, and the body can let go
Pills mostly act on the third panel. The first two are free and do more.
Get up at the same time every day
The best-tested treatment for chronic insomnia isn't a pill. It's cognitive behavioural therapy for insomnia (CBT-I), and its strongest piece is simple: get up at the same time every day, and only go to bed when you're sleepy. That builds sleep pressure and pins the clock, and it beats sleeping pills in head-to-head trials over the long run. Sleeping in on weekends shifts your clock later, like flying a time zone west every Friday. That's why Monday morning hurts.
How: pick a wake time you can keep 7 days a week, and get up then even after a bad night. If you're lying awake for more than about 20 minutes, get up and do something dull in dim light until you're sleepy.
The clock resets from light-sensing cells in the eye that respond most to blue-rich daylight. Indoor light is a few hundred lux, while an overcast morning outside is 1,000–10,000. Morning daylight moves your clock earlier, so you get sleepy earlier. Bright light in the evening, from overhead lights or screens, does the opposite and holds melatonin back. People who spend the day indoors and the evening under bright light get a weak signal at both ends.
How: get outside within an hour of waking for 10–30 minutes, longer if it's grey. After sunset, use warm, low lamps and dim screens. A dark bedroom matters too: blackout curtains, and no standby lights.
Caffeine's half-life is about 5 hours, and longer in some people, so half of a 2 pm coffee is still in you at 7 pm. In a Henry Ford Hospital trial, 400 mg of caffeine (about two big coffees) taken 6 hours before bed still cut total sleep by more than an hour. People often didn't notice the loss. Caffeine also makes deep sleep shallower even when you fall asleep fine.
How: last coffee before noon, or 8–10 hours before bed. Watch for hidden caffeine in tea, pre-workout, cola and dark chocolate in the evening.
Alcohol is a sedative, so you fall asleep faster. But as it's broken down in the second half of the night, the rebound shows up: lighter sleep, more waking, a faster heart rate and suppressed REM sleep. It also relaxes the throat muscles and worsens snoring and apnoea. The classic 3 am wake-up after drinks is this.
How: if you drink, drink with dinner, and stop 3 or more hours before bed. Have water alongside it.
In obstructive sleep apnoea the throat closes over and over during sleep. Oxygen drops, adrenaline spikes, and the brain half-wakes to reopen the airway, often hundreds of times a night without you remembering. It's common, mostly undiagnosed, and drives high blood pressure, heart rhythm problems, daytime exhaustion and blood-sugar problems. Weight around the neck, alcohol, sleeping on your back and a blocked nose all make it worse.
Breathing through your nose helps in milder cases. The nose filters and humidifies air and carries nitric oxide from the sinuses into the lungs. Mouth breathing pulls the jaw back and narrows the airway.
How: if you snore loudly, gasp, wake with a headache or a dry mouth, or sleep 8 hours and still feel wrecked, get a sleep study. Home tests are cheap now. Treat nasal congestion, sleep on your side, and keep alcohol early.
To fall asleep, the body moves heat from its core out through the hands and feet, and core temperature drops about 1 °F (0.5 °C). A warm room slows that drop and means less deep sleep and more waking. Oddly, a warm shower or bath 1–2 hours before bed helps, because it pulls blood to the skin and speeds the cooling afterwards. A big late meal works against you by raising body temperature and keeping the gut busy.
How: about 60–67 °F (16–19 °C), breathable bedding, a warm shower an hour or two before bed, and dinner finished 2–3 hours before lights out.
Exercise builds sleep pressure, raises body temperature in the day so the evening drop is bigger, and deepens slow-wave sleep. In trials it improves sleep quality and helps insomnia, and the effect builds over weeks. Outdoor exercise in the morning also gets you daylight. A very hard session right before bed can keep some people wired, so earlier is safer.
How: train or walk most days, preferably outside and before evening. If evening is the only time, keep the last hour easy.
Glycine widens blood vessels in the skin, which drops core temperature, the same signal as the cool room. In placebo-controlled trials, 3 g before bed improved sleep quality and next-day alertness. Magnesium calms nerve firing. In a trial of 46 older adults with insomnia, 500 mg a day helped them fall asleep faster and sleep more efficiently, and their melatonin rose. Both help most when you're short, and neither is a sedative.
How: ¾ tsp (3 g) glycine powder in water or tea, plus 200–400 mg magnesium glycinate, about an hour before bed. Glycinate covers some of both.
L-theanine. Doesn't make you fall asleep faster, but sleep is sounder in trials. 200–400 mg an hour before bed. L-Theanine
Chamomile tea. Helps sleep disturbed by stress, age or a new baby. It didn't help established insomnia. Chamomile
Low-dose melatonin, for jet lag or shift work. 0.3–1 mg a few hours before your new bedtime moves the clock. It's a timing signal, not a knock-out pill. A Canadian lab test found melatonin pills ranged from 83% below to 478% above their label, so pick a pharmaceutical-grade brand.
Tart cherry juice. Contains a little melatonin. Small trials in older adults with insomnia found modest gains. 1 cup twice a day.
Diphenhydramine and doxylamine (ZzzQuil, Tylenol PM, Unisom)These are anticholinergic antihistamines. They leave you groggy the next day, and in a cohort of 3,434 older adults, heavy long-term anticholinergic use tracked with more dementia.
High-dose melatonin every night3–10 mg is far above what your body makes. It can leave you groggy and doesn't fix the clock better than a small dose and morning light.
The nightcapFaster to fall asleep, worse sleep overall.
Obsessing over a sleep trackerWrist trackers guess sleep stages poorly, and anxiety about the score can itself keep you up. How you feel at 10 am is the better metric.
If sleep is still bad, check these
Snoring, gasping, morning headacheSleep apnoea. Get a sleep study.
Restless, creepy legs at nightRestless legs often tracks with low iron stores. Check ferritin. Iron
Waking at 3 am, wiredLate alcohol, a blood-sugar dip after a sugary evening, or high evening cortisol. Stress
Getting up to peeLate fluids, alcohol and caffeine, or untreated apnoea, which raises a hormone that makes urine.
Can't fall asleep before 2 amA late-shifted clock. More morning light, less evening light, low-dose melatonin in the early evening.
Racing heart, heat intolerance, weight lossAn overactive thyroid. Ask for a TSH test.