Back to BlogSleep & Recovery

Can Your Afternoon Coffee Still Affect You at Bedtime?

Caffeine's timing and dose both matter. A crossover trial shows why falling asleep, time asleep and deep sleep can tell different stories.

7–9 min read

You finish your coffee after a three o'clock meeting. By eleven that night, the afternoon lift has worn off. If you have trouble sleeping, could that cup still have something to do with it?

It could. How long before bed you had caffeine matters, and so does how much you had. In one trial, an additional 400-milligram dose four hours before bedtime reduced measured sleep by about 51 minutes compared with placebo. At the same time point, the study could not detect a clear difference after an additional 100 milligrams. To understand what your last cup has in common with that trial, start with the dose and the time together [1].

Feeling less sleepy and getting more sleep are different things

As you spend more of the day awake, the pressure to sleep generally builds. A chemical called adenosine plays a role in that signal. Think of a receptor as having a seat in which a molecule can fit. Adenosine can sit there and pass on a message. Caffeine can occupy the seat and make it harder for adenosine to send that signal [1][2].

Blue adenosine occupies a receptor on the left. On the right, gold caffeine occupies the same kind of receptor, leaving adenosine outside it.

Researchers have used PET brain imaging to see caffeine compete for one kind of adenosine receptor in people. The study found that more of these receptors were occupied when caffeine levels were higher. The scan measured what was happening at the receptor. To find out how much a person actually slept that night, you need a different measurement [2].

You may also lose track of the feeling that your coffee gave you. By bedtime, feeling ready to sleep is one thing you can report. A monitor recording how much you slept is another. When the two measures give different impressions, that doesn't make either one useless. Each one picks up something about the same night [1].

Seven conditions, and every volunteer tried all seven

The trial included 23 adult men, about 25 years old on average, who habitually consumed less than 300 milligrams of caffeine a day. Each took part in a placebo condition and in tests of 100 or 400 milligrams of caffeine taken 12, eight or four hours before usual bedtime. The order was randomized and there was a 48-hour gap between conditions. The investigators and participants didn't know which capsules contained caffeine during the experiment [1].

On each test day, everyone took a capsule at all three scheduled times. At most one capsule contained caffeine, and all three were placebos in the control condition. Each participant also took the amount of caffeine they normally consumed in a day in a capsule shortly after waking, then avoided other sources during the day. That set a consistent background so the study could compare the effects of the extra capsule [1].

Three capsule positions on a timeline leading to a bed represent the three tested intervals before bedtime.

Everyone went through each condition, so someone who was usually a light sleeper could still be compared with himself on other nights. At home, participants used a sleep-monitoring device that measured features of their sleep. They also filled in sleep diaries. The trial could compare time spent asleep, different stages of sleep and how participants thought the nights had gone [1].

For an 11 p.m. bedtime, the three test times would be 11 a.m., 3 p.m. and 7 p.m. If your usual bedtime is 1 a.m., coffee at 3 p.m. is ten hours before bed instead. The researchers scheduled the capsules relative to each person's usual bedtime. In daily life, the time on the receipt only tells you one end of that interval [1].

Which condition cost about 51 minutes?

Compared with placebo, a 400-milligram dose four hours before bed reduced estimated total sleep time by 50.6 minutes. At eight or 12 hours, the differences in total sleep time did not reach statistical significance. At 12 hours, though, the monitor recorded about 21 fewer minutes of deep sleep. The total number of sleeping minutes and the number of minutes in a given stage can move differently [1].

The same trial did not find statistically significant differences in the objective sleep measures after 100 milligrams at the tested times. That was the result in this group of men across these conditions. The trial didn't measure a dose at bedtime itself or test every combination of amount and timing you could encounter. It can't turn 100 milligrams into a personal cutoff for every reader [1].

Check which measurement the number refers to. Total sleep time adds up time asleep. Deep sleep time refers to a stage within the night. The diary reflects how the night felt to the person who slept it. Each measure has its own result in the study [1].

What if you fell asleep as quickly as usual? You can still have an unusual number of awake minutes after first falling asleep. That distinction is useful when you look at a study or a sleep log: “It took a while to get to sleep” and “I was up for a while in the middle of the night” point to different parts of the night. A report can capture one without saying much about the other [1].

A separate study gave 12 adults 400 milligrams shortly before bed, three hours before or six hours before, on separate nights. The home monitor recorded less sleep even in the six-hour condition. Comparing the protocols helps explain why these trials give specific points on a timeline. Neither followed the effect of every amount in every drink at every possible interval [1][3].

Write down the last drink, including what was in it

Two drinks sold in the same cup can contain different amounts of caffeine. If the package gives milligrams per serving, check how many servings are in the container. A hypothetical iced tea with 60 milligrams per serving and two servings in the bottle contains 120 milligrams in all. Drinking half the bottle would give you about 60 milligrams. If you have another caffeinated drink after the coffee, the coffee wasn't your last exposure that day.

A coffee mug and a glass of iced tea sit by a notebook and pencil for recording the time and amount of caffeinated drinks.

To see how your own afternoons and evenings fit together, record the time, drink and amount for a few days. Note when you went to bed, how long it seemed to take to fall asleep and whether you remember getting up at night. If you try moving your last cup earlier, compare evenings with similar work and bedtime schedules when you can. A loud night outside or an unusually early alarm can go in the notes too.

Start with the next three o'clock cup. Find out how much caffeine it contains, then count the hours back from the bedtime you're aiming for. A few entries give you more to compare than a single night when you happened to sleep poorly.

References

[1] Gardiner CL, et al. Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. Sleep. 2025;48(4):zsae230.

[2] Elmenhorst D, Meyer PT, Matusch A, Winz OH, Bauer A. Caffeine occupancy of human cerebral A1 adenosine receptors: in vivo quantification with 18F-CPFPX and PET. J Nucl Med. 2012;53(11):1723–1729.

[3] Drake C, Roehrs T, Shambroom J, Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. J Clin Sleep Med. 2013;9(11):1195–1200.