What to Do When You Can’t Sleep: Science-Backed Tips

If you’re lying awake right now, the single most effective thing you can do is get out of bed. It sounds counterintuitive, but staying in bed while frustrated trains your brain to associate the bed with wakefulness. Leave the bedroom after 15 to 20 minutes of not falling asleep, do something quiet in another room, and return only when you feel genuinely sleepy again.

That one move comes from a clinical technique called stimulus control, and it’s the backbone of the most effective non-drug treatment for insomnia. But there’s more you can do tonight, and more you can change tomorrow, to make sleepless nights less frequent.

The 20-Minute Rule

When you can’t fall asleep (or you wake up in the middle of the night and can’t drift back off), give yourself roughly 15 to 20 minutes. Don’t watch the clock obsessively. Just estimate. If sleep isn’t coming, get up, go to a different room, and do something low-key until drowsiness hits. Good options include reading a physical book, listening to soft music, doing a crossword puzzle, meditating, or writing in a journal.

What you want to avoid: housework, exercise, video games, scrolling on your phone, working on a computer, or watching anything intense on TV. These activities either wake your body up or engage your brain in ways that push sleep further away. And don’t fall asleep on the couch. The goal is to rebuild the connection between your bed and sleep, so the bed needs to be the only place you sleep.

Repeat this cycle as many times as needed. Some nights that means getting up two or three times. It feels frustrating at first, but over days and weeks it retrains your brain so that getting into bed triggers sleepiness instead of anxiety.

Calm Your Nervous System With Breathing

When you can’t sleep, your body is often stuck in a stress response: heart beating faster than it should, breathing shallow, muscles tight. Structured breathing directly activates the part of your nervous system responsible for calming you down, lowering your heart rate and blood pressure into a state that’s actually compatible with sleep.

The 4-7-8 technique is one of the simplest. Inhale through your nose for four counts. Hold your breath for seven counts. Exhale slowly through your mouth for eight counts. Do three full cycles. The long exhale is the key, because it forces your body to shift out of fight-or-flight mode. This works better with practice. If you do it twice a day (not just at bedtime), your body gets faster at making the switch when you actually need it at night.

Relax Your Body From the Feet Up

Progressive muscle relaxation works on a simple principle: a muscle that’s just been deliberately tensed will relax more deeply than one you simply tell yourself to relax. Start with your feet. Curl your toes and arch your feet, hold for a few seconds, then release and let them sink into the mattress. Move slowly upward: calves, thighs, buttocks, lower back, abdomen, upper back, shoulders, arms, hands, neck, jaw, forehead.

Breathe softly throughout. By the time you reach your forehead, most people notice a heaviness in their body that wasn’t there before. This technique is especially useful if you carry physical tension from the day, the kind where your shoulders are up near your ears and your jaw is clenched without you realizing it.

Stop Racing Thoughts With Cognitive Shuffling

If your problem isn’t physical tension but a brain that won’t shut up, try cognitive shuffling. Pick a simple, emotionally neutral word like “table” or “chair.” Take the first letter and think of as many words as you can that start with it. For “table,” you’d start with T: tree, train, towel, turtle. When you run out, move to A: apple, arrow, ant. Then B, then L, then E.

The randomness is the point. Your brain can’t simultaneously generate nonsense word lists and spin up anxious narratives about tomorrow’s meeting. If you lose track of where you are or forget your starting word, that’s a sign it’s working. You’re losing the structured thinking that keeps you awake. Start a new word if you need to, but most people don’t make it through the first one.

Deal With Worries Before Bed, Not During

Many people find that the moment their head hits the pillow, every unresolved problem from the day floods in. A scheduled worry period can short-circuit this. Earlier in the evening, well before bedtime, sit down for about 20 minutes in a specific spot (not your bedroom) and write down everything that’s bothering you. Work through what you can, acknowledge what you can’t, and close the notebook.

When those worries resurface at night, you can tell yourself you’ve already given them their time. This sounds too simple to work, but it gives your brain permission to defer. The consistency matters: same time, same place, same duration each day. Over time, your mind learns that nighttime is not when problem-solving happens.

Fix Your Bedroom Environment

Your bedroom temperature has a surprisingly large effect on sleep quality. The ideal range for adults is 60 to 67°F (15 to 19°C). Your body needs to drop its core temperature slightly to initiate sleep, and a warm room fights that process. If you don’t have precise thermostat control, a fan, lighter bedding, or even just cracking a window can help.

Darkness matters too. Your brain produces melatonin (the hormone that makes you sleepy) in response to darkness, and light suppresses it. In one Harvard experiment, blue light from screens suppressed melatonin for about twice as long as green light and shifted the body’s internal clock by three hours. The practical takeaway: stop looking at bright screens two to three hours before bed, or at minimum use a red-light filter in the last hour.

Watch Your Caffeine Cutoff

Caffeine has a half-life of four to six hours, meaning that half the caffeine from your 3 p.m. coffee is still circulating in your system at 9 p.m. One study found that caffeine consumed even six hours before bedtime measurably disrupted sleep, even when people didn’t feel any different. A reasonable cutoff for most people with a standard evening bedtime is 2 or 3 p.m. If you’re particularly sensitive, noon may be a better boundary.

Supplements That May Help

Magnesium is one of the more evidence-supported options for sleep. It plays a role in the nervous system pathways that help your body wind down. A typical recommendation is 250 to 500 milligrams taken as a single dose at bedtime. The glycinate form tends to be gentler on the stomach and is the type most often suggested for sleep. Results aren’t dramatic for everyone, but people who are low in magnesium (common with a typical Western diet) often notice a difference within a week or two.

When Sleepless Nights Become a Pattern

An occasional bad night is normal. Chronic insomnia is a different situation, and there are specific thresholds that separate the two. If you’re having trouble falling asleep, staying asleep, or waking up too early on three or more nights per week, and this has been going on for at least a month, that meets the clinical criteria for insomnia. At that point, the most effective treatment is cognitive behavioral therapy for insomnia (often called CBT-I), which combines the techniques above into a structured program. It outperforms sleeping pills in long-term studies and doesn’t carry the risks of medication dependence.

CBT-I is available through therapists who specialize in sleep, and also through several validated apps and online programs if in-person access is limited. Most people see significant improvement within four to eight weeks.