Sleep Part II: How to Sleep Better

Now that I’m thoroughly convinced I’ll be healthier if I get at least seven hours of sleep a night, I want to maximize the quality of that sleep. For this post, I want to find experiments that put common sleep advice to the test. Call it ‘Mythbusters: Sleep.”

I think some people get so obsessed with advice like that collected below they might miss the most important ingredient: lying horizontally for seven to eight hours a night. If you find yourself having trouble getting to sleep or staying asleep, these tips will get you maybe 30 extra minutes of sleep.

How We Sleep

Matt Walker’s book Why We Sleep says there are two things going on in our brain to guide us to sleep and back awake: build up of melatonin and adenosine, which mediate our circadian rhythm and sleep pressure. Melatonin, he claims, is a necessary but not sufficient condition to fall asleep. A second necessary condition is a buildup of adenosine. “The longer you are awake, the more adenosine will accumulate.” The combined rise of melatonin and adenosine makes you fall asleep. With these mechanisms in mind, what can we do to sleep better?

Avoid Prescription Sleeping Pills

Modern sleeping pills like Ambien (zolpidem) and Lunesta (eszopiclone), as a group called non-benzodiazepines, induce sleep by a different mechanism than melatonin or adenosine. Whatever the mechanism, they do work, sort of. A meta-analysis of 65 experiments that used electrodes to measure how people slept – called polysomnography – found that people fell asleep 11 minutes earlier with a placebo and 33 minutes earlier with a non-benzodiazepine than with no pill at all. This meta-analysis was based on data submitted to the FDA, which means that companies are required to submit the data whether the trial is a success or not, helping to prevent publication bias or p-hacking. 22 or 33 minutes of extra sleep is actually a huge effect. The natural experiment I quoted a few posts back found that people in cities with early sunsets sleep just 8.5 minutes longer but are 5% more productive.

There are some problems with these drugs, though. One randomized trial found that non-benzodiazepines significantly reduced slow-wave activity (SWA) during non-REM sleep. In my next post I’ll go over some of the trials Walker cites for his claim that the duration of SWA is a useful predictor of how much sleeping will improve your cognitive performance. Walker cites some animal studies that ambien is bad for memory, but apparently there aren’t yet any experiments on sleeping pills and memory in humans. For now, let’s just say it’s probably not good if sleeping pills are disrupting your NREM sleep.

A bigger problem with sleeping pills: they might kill you. A retrospective (observational) study compared outcomes for about 10,000 people on sleeping pills and about 24,000 people not on sleeping pills. People were grouped based on having the same or similar age, gender, smoking status, and a collection of other medical diagnoses. Within similar groups, people taking sleeping pills were 3-5 times more likely to die. The effect grew with more frequent sleeping pill use, which we’d take as supporting evidence if this were a randomized trial. Several important controls were missing from, though. They were not able to track depression and, a more obvious hole, they didn’t track insomnia. An improved observational study would look at people diagnosed with insomnia and see how outcomes differ for people on prescription sleeping pills versus some other treatment. Insomnia is probably a side effect of other health problems they didn’t track. The effect size of a 3x increase in mortality for the lowest dose group, one half to 18 pills per year, is totally implausible; this would be a much larger effect than chain smoking. Finally, the randomized trials used for FDA approval did not report increased mortality (or they wouldn’t have been approved!). Nonetheless, it’s cause for concern.

The American College of Physicians in a 2016 review came to the “strong recommendation” based on “moderate-quality evidence” that cognitive behavior therapy for insomnia (CBT-I) should be the first-line treatment for insomnia. Only after a patient struggles with CBT-I do they make a “weak recommendation” for short-term use of sleeping pills, based on “low-quality evidence.” CBT-I runs through the recommendations I’ll evaluate below, after discussing melatonin supplements.

Melatonin Supplements

In contrast to prescription sleeping pills, nobody I can find claims melatonin supplements have an effect on your mortality and the study I cited above about NREM sleep found that melatonin supplements caused no harm. A 2004 meta-study found that melatonin supplements increase total sleep time roughly 13 minutes compared to placebo, about half the effect of prescription sleeping pills. It found that maximum effectiveness was at a dose of 0.3 mg with no gain, and possibly some loss of effectiveness, at higher doses. This last point might be a problem because drug store melatonin is typically 3-5 mg. I’ve seen other blog posts citing this meta-studies as proof that these doses are way too high.

A more recent meta-study from 2013 that included eight studies from after 2004 also found that people taking melatonin fall asleep 7 minutes faster (p < 0.001) and slept a total of 8 minutes longer (p = 0.013). Their results were different for dose, though. They found that higher doses, all the way up to 5 mg, were correlated with longer sleep. I have no explanation for the different results on dose. 3 mg is easily available, whereas it’s slightly inconvenient to cut pills into halves (or quarters (or tenths)), so I just buy 3 mg pills and take them whole.

Parting melatonin tip: I think it’s common practice to take melatonin right before bed. These studies generally had people take their melatonin 2-3 hours earlier than that.


Fluctuation of your core body temperature is closely related to your circadian rhythm. Observational studies have found that you’re most likely to fall asleep when your core body temperature is at a minimum (study). Other studies go a step further and find that sleep onset “is most likely to occur when body temperature is declining at its maximum rate” (study, additional study). Can we manipulate our core body temperature to get better sleep? One of the melatonin studies above found that taking melatonin supplements suppressed core body temperature, suggesting one mechanism of action. How about something more direct?

Counterintuitively, one experiment found that using a “water perfused thermosuit” to raise the temperature of the skin by about 1 degree made people fall asleep about two minutes faster. Maybe you can just wear warm socks? Experiments from 1985, 1987, 2000, and 2008 all found that taking a hot bath before bed decreased time to fall sleep and increased slow wave sleep, which Walker claims is the part of sleep most important for memory and cognitive function. The reason a hot bath causes higher quality sleep seems to be a bit up in the air, but it works.

Walker claims that “a bedroom temperature of around 65 degrees Fahrenheit is ideal for the sleep of most people,” and that “lower than 55 degrees Fahrenheit can be harmful.” He doesn’t provide citations or say what experiments prove either of these claims. I’ve found lots of other people online who assert a similar temperature, but haven’t yet found any actual evidence. I think it might just be received wisdom. Let me know if you find a relevant experiment, though!


Caffeine disrupts your sleep (here’s an experiment in case you don’t believe) by blocking adenosine receptors (see this review from 2016), but how bad is it and how long before bed should you avoid it?

For reference, here’s a nice figure from Coca-Cola with the caffeine content of different drinks. They leave off Diet Coke, which has 42 mg of caffeine in a can, higher than regular Coke.


In this conversation, people often refer to the half-life of caffeine in your body. I’m not sure that’s the most useful number here. Half-life is a useful concept when you’re talking about exponential decay, but I’d bet that the process of your liver clearing caffeine out of your body is more linear than exponential. Your liver can probably only remove caffeine so quickly and I’m guessing coffee or soda pushes us way over the limit at which it’s working as hard as it can.

In this experiment, men were given a 200 mg dose of caffeine, about 1.5 cups of coffee, at 7 am. Sixteen hours later, they still had a bit of caffeine in their saliva. The peak at 8 am is about 17 umol/l and the value at 11 pm is 2.6 umol/l. The decay looks pretty linear at a rate almost exactly 1 umol/l/hour. I’ll use this in a minute when I guesstimate how late in the day I can drink Diet Coke.

Screen Shot 2019-01-01 at 2.03.51 PM.png

So how much did 200 mg of caffeine first thing in the morning disrupt sleep? People in this experiment didn’t notice any changes, but the electrodes showed a 10-minute increase in time to fall asleep. As for later in the day, this experiment found that 400 mg of caffeine six hours before bed reduced total sleep from 7.7 hours to 6.5 hours and slow-wave sleep from 71 minutes to 49 minutes. That’s a huge dose, though – two to three full cups of coffee – so even six hours before bed nobody should be surprised by the effect size.

The 2016 review I cited above didn’t turn up any other experiments about when in the day to stop drinking caffeine. We’ll have to make a Fermi estimate here.

[Back of the envelope math you should feel free to skip: Apparently 200 mg of caffeine pushes the caffeine in your saliva to about 20 umol/l and your liver clears about 1 umol/l/hour after about a one-hour delay. You want to go to bed with about 2 umol/l or less. One Diet Coke will probably raise your caffeine saliva levels to about 4 umol/l. About three hours later, it should be back down to 2 umol/l.]

That means I should be able to drink one Diet Coke at 8 PM and go to bed just fine at 11 PM. In my subjective experience, that’s too late in the day for a soda. These experiments all show wide variation between individuals, so maybe try some experiments on yourself and default on the side of less caffeine.


While alcohol is still in your blood, it promotes sleep, but after it is completely cleared from your blood “rebound effects” disrupt your sleep (see this 2001 review). What’s the net effect? Is any amount of alcohol right before bed too much? What if you have a small enough amount of alcohol early enough in the day that your BAC is back to zero when you go to bed? For answers to these questions and more, stay tuned!

What happens when you drink right before bed? This experiment from 1980 gave doses of 0.16, 0.32, or 0.64 g/kg (for reference, a ‘standard drink’ has 14 grams of alcohol). For me, at 64 kg, that’s roughly one to three drinks. It found that net-net the lowest dose increased total sleep time, but all three doses reduced slow-wave sleep, with most of the cost coming later in the night.

What about when you drink earlier in the day? This experiment from 1996 is the larger of two I found that look at consumption of alcohol early enough in the day that BAC has declined to 0 before bedtime. They gave 10 men enough alcohol to raise their BAC just over the legal limit six hours before bed (blood alcohol content typically decreases at 0.01 to 0.02% per hour). Total sleep time fell over 26 minutes in the alcohol group, due almost entirely to a 28-minute increase in wakefulness during the final two hours of sleep.

In sum, it looks like getting a little drunk early enough in the day that your BAC hits zero right as you go to bed still disrupts your sleep quite a bit. Having just a single drink, even if it’s right before bed, only very slightly disrupts sleep.

Blue Light

Matt Walker, along with the entire internet, says that blue light from screens disrupts our sleep. Three studies in a total of 32 adults and 13 teenagers found that amber glasses that block blue light result in higher melatonin secretion and better sleep than placebo glasses that are yellow and only block UV light (1, 2, 3). I’d describe the overall evidence as weak, and if the mechanism of action is just melatonin suppression, it’s unclear to me if you can get the same benefit by taking melatonin. The cost of amber glasses is low, but in my experience significant others are likely to object to their appearance. Many house lights have lots of blue light, as do TV’s, so red-shifting your phone and computer screens probably won’t do much. Chugging caffeine while you yell at people on Facebook behind amber tinted glasses probably won’t give you a good night’s sleep either.


Exercise may offer moderate benefits for sleep, but the observational evidence is plagued by confounding health problems that make both sleeping and exercising difficult and the experimental evidence is weak. We’ll have to break this into two parts: one for long-term effects of a sustained exercise program and one for sleep the night after exercise.

First, general fitness. This 2012 meta-study only found six RCT’s that measured the benefits of ongoing exercise for adults 40+ years old with sleep complaints. Five of the six trials relied entirely on self-reported sleep quality. Trials of exercise can’t be blinded, so these self-reports are subject to bias. The one experiment that used electrodes to measure people’s sleep carefully showed that a 12-month exercise program improved fitness but failed to improve sleep.

As an aside, the paper about this carefully conducted trial is a great example of reporting bias and p-hacking. One tool to prevent p-hacking is to say in advance what the one or two most important things are in your study, called ‘primary outcomes.’ If you can measure twenty things, you probably will. And if you do, one of them will probably look statistically significant. That setup means every trial will reject the null hypothesis (no difference between treatment and control groups). But if your trial is nearly guaranteed to reject the null hypothesis, it actually doesn’t teach us anything. Designating primary and secondary outcomes before you run the experiment lets you measure everything you want without ruining the statistical validity of your trial. The authors of this paper responsibly marked total sleep time and sleep latency as primary outcomes and everything else as secondary. HOWEVER, the abstract only mentions secondary outcomes that reject the null hypothesis, without even noting that they were secondary. You have to read the full text of the article to find out that their experiment actually accepted the null hypothesis that an exercise program to improve fitness does not improve sleep. Most people – including most scientists – will only read the abstract. They’ll come away thinking the experiment showed the opposite of what it actually did.

This 1997 meta-study found 38 faster experiments that measured sleep the night after exercise, all using electrodes in adults described as “good sleepers.” They found that total sleep time goes up about 10 minutes with exercise and the effect size grows with the duration of exercise. Time to fall asleep and wakefulness during sleep had insignificant differences.

In summary:

  • Prescription sleeping pills have a huge, positive effect on sleep, but give you bad sleep, come at high risk of dependency, and may increase mortality.
  • Melatonin supplements well before bed have a smaller but still large effect without the risk of dependency or mortality.
  • Wearing clothes that keep your hands and feet warm or taking a warm shower or bath should help you sleep.
  • Keep total caffeine consumption below 200 mg per day and keep soda at least three hours from sleep.
  • Keep alcohol to one drink. If your BAC hits zero right as you go to bed, it will still disrupt your sleep.
  • Covering your eyes in amber glasses might help, but will make you look ridiculous. Melatonin supplements may make this unnecessary.
  • Being generally fit probably doesn’t get you to sleep faster. An hour or two of exercise probably will make you sleep about 10 minutes longer the night after.


One thought on “Sleep Part II: How to Sleep Better

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s