It all results in the same thing: you just can’t get to sleep. But the underlying causes of insomnia are multiple, and it may be a mix of biological, medical and psychological issues, explains Michael Perlis, director of the Behavioral Sleep Medicine Program at the University of Pennsylvania.

Insomnia falls into several broad categories based on those times of the night when you have problems sleeping, and these tend to align with predictable triggers. “A general rule of thumb is that if you’re struggling to fall asleep at the start of the night, that’s due to anxiety or stressful life events,” Perlis says. Environmental issues—like a too-bright room, or staring at device screens—can also mess with your ability to fall asleep.

On the other hand, Perlis says depression is linked with “late insomnia”—the kind that wrests you from sleep so late in the night that you’re forced to rise early for the day.

Looking to improve your sleep? Subscribe to TIME’s guide for answers to all your burning sleep questions.

When it comes to “middle insomnia,” which forces your eyes open a few hours after you’ve fallen asleep, Perlis says two common medical conditions are often to blame: gastroesophageal reflux disease, or GERD, and sleep apnea. “In the case of sleep apnea, you wake up because you’ve stopped breathing,” he explains. “With GERD, you wake up because stomach acids are burning your esophagus.”

Even the healthiest sleepers wake a few times during the night, though for the most part you’re not awake long enough to remember them, Perlis says. But if you can recall waking up briefly throughout the night—usually just for a few minutes at a time—an underlying medical issue like sleep apnea is likely the problem, and you should see a doctor.

Age could also be a factor in disturbed sleep. “As we get older, our sleep efficiency decreases and we have more light stage-one sleep,” says Dr. Sandra Horowitz, a clinical instructor with Harvard Medical School’s Division of Sleep Medicine. Lighter sleep leads to more awakenings. Some medications, particularly beta blockers and other heart meds, can make these age-related sleep disturbances worse, she adds.

There are many other explanations for tossing and turning. Everything from a room’s ambient temperature to concerns about job security can disrupt slumber. But if you always wake up right around 3 a.m.—or at some predictable interval after you’ve hit the sack—alcohol is probably to blame, says Dr. Damien Stevens, a doctor of sleep and pulmonary medicine at the University of Kansas Hospital. “Depending on your metabolism, alcohol going to leave your system after a few hours,” Stevens explains. “When that happens, you wake up.”

According to Timothy Roehrs, director of sleep disorders research at Henry Ford Hospital in Detroit, booze has a “paradoxical” effect on your slumber in that it both helps and hurts the quality. Much of Roehrs’s career has focused on the effects alcohol has on sleep. His research suggests that soon after you consume alcohol, that glass of wine or tumbler of bourbon helps speed your descent into slumber.

“The sleep alcohol induces is associated with intense slow-wave brain activity, which is considered to be the deepest, most restorative kind of sleep,” he says. That deep sleep dominates the first part of your night. But your body breaks down and metabolizes alcohol very quickly, and once it’s finished with that chore, your sleep becomes fitful.

Nobody exactly knows why, Roehrs says. But he and other experts think that brain chemicals that cause wakefulness are somehow stimulated when your body finishes burning off the alcohol in your blood. The process by which your body breaks down alcohol doesn’t vary much. So if you usually swallow the same amount of wine or beer each night and go to sleep around the same time, you’re going to wake up at a predictable hour, Roehrs says.

But there’s good news for those who enjoy a nightcap. Depending on your tolerance for alcohol, low or even moderate amounts of it won’t necessarily disrupt your sleep, Perlis says. “How much you can have depends on your drinking history, how big you are, your age and other things,” he says. “But if you drink and you’re invariably waking up three to five hours after you go to sleep, that’s a great indicator that alcohol is the issue.”

Cut back on booze, and see what happens to your sleep.

More Must-Reads from TIME

Contact us at