As sleep expert and holistic psychiatrist Ellen Vora, M.D., previously explained to mbg, caffeine has a half-life of five to seven hours for most people, meaning it takes roughly six hours for your body to metabolize half of that cortisol-inducing caffeine—and another six hours to metabolize half of that.

“A cup of coffee at 9 a.m. is still lingering in your body at bedtime, and having a cup of coffee at 3 p.m. is effectively like drinking half a cup of coffee at 9 p.m.,” she says, adding, “even a little bit of caffeine lingering in the body can disrupt the quality of your sleep.”

In addition to that, research has shown caffeine doesn’t actually make up for poor sleep, creating what Vora calls a vicious cycle of bad sleep, more caffeine consumption, more bad sleep, and so on.

While new research shows that caffeine might not affect certain body functions (such as heart rate) as much as we previously thought, gastroenterologist Marvin Singh, M.D., previously told mbg that he still recommends drinking less of it if it makes you experience things like anxiousness, headaches, digestive issues, and of course, sleeplessness—no matter what time of day it is.