What to Do When You Can’t Sleep at Night

If you’re lying in bed unable to sleep, the most effective thing you can do right now is get up. It sounds counterintuitive, but staying in bed while awake trains your brain to associate the bed with frustration instead of rest. Below are practical steps you can take tonight and habits that prevent the problem from repeating.

Get Out of Bed After 15 to 20 Minutes

Stanford’s Sleep Health and Insomnia Program recommends leaving the bedroom if you haven’t fallen asleep (or back to sleep) within 15 to 20 minutes. Go to another room and do something quiet: read a book, listen to calm music, or watch something low-key. The activity should be engaging enough that you don’t dread getting up, but not so stimulating that your mind revs up further. Don’t sleep on the couch. Return to bed only when you feel genuinely sleepy, not just tired. Repeat the cycle as many times as needed.

This technique, called stimulus control, is one of the core tools in cognitive behavioral therapy for insomnia. Over time it rebuilds the connection between your bed and sleep, so lying down starts to feel like a reliable cue to drift off rather than a trigger for frustration.

Slow Your Breathing Down

When you can’t sleep, your body is often stuck in a mild stress response: heart rate slightly elevated, muscles subtly tense, mind scanning for problems. Controlled breathing flips the switch toward your body’s rest-and-digest mode, lowering heart rate and blood pressure.

The 4-7-8 technique is simple enough to do in the dark. Inhale through your nose for four counts, hold for seven counts, then exhale slowly through your mouth for eight counts. The long exhale is the key part. It activates the branch of your nervous system responsible for calming you down. Three or four cycles is usually enough to notice a shift. If counting feels awkward, just focus on making each exhale noticeably longer than each inhale.

Give Your Brain Something Boring to Do

A racing mind is one of the most common reasons people can’t fall asleep. The problem isn’t that you’re thinking; it’s that you’re thinking about things that matter to you, which keeps your brain alert. The fix is to occupy it with something that doesn’t matter at all.

One method, called cognitive shuffling, works like this: pick a random word, say “plant.” Then picture objects that start with P (pillow, penguin, piano). Move to the next letter, L, and picture words starting with L (lamp, lemon, ladder). The images should be random and unrelated. Because the brain can’t build a coherent story from this nonsense, it loses its grip on whatever was keeping you awake. Unlike counting sheep, the randomness prevents boredom and keeps you from drifting back into anxious loops.

If that feels like too much structure, simply visualizing a calm, detailed scene (walking through a familiar forest path, exploring rooms in an imagined house) works on the same principle. The goal is gentle mental engagement that crowds out stressful thoughts.

Relax Your Body From the Ground Up

Progressive muscle relaxation is a technique where you deliberately tense a muscle group for a few seconds, then release it completely. The release creates a deeper relaxation than you’d get from just lying still. Start with your toes: curl them tightly, hold for five seconds, then let go and notice the heaviness. Move up through your calves, thighs, buttocks, lower back, abdomen, upper back, shoulders, arms, hands, neck, jaw, and forehead.

Harvard Health recommends breathing softly throughout and paying attention to the contrast between tension and release. Most people don’t make it to their forehead before they start feeling drowsy. The whole sequence takes about 10 to 15 minutes, and it works well combined with the breathing technique above.

Check Your Bedroom Temperature

Your body needs to drop its core temperature slightly to initiate sleep. A warm room fights this process. The Cleveland Clinic recommends keeping your bedroom between 60 and 67°F (15 to 19°C). Anything above 70°F is too warm for most adults. If you can’t control the thermostat, a fan, lighter blankets, or wearing less to bed can help. For babies and toddlers, the ideal range is slightly higher, between 65 and 70°F.

If your feet are cold, that’s worth addressing too. Cold extremities signal to your body that the environment isn’t safe for deep rest. Wearing socks to bed can actually help you fall asleep faster by improving blood flow to your skin, which paradoxically helps your core temperature drop.

Screens and Light Exposure

Bright screens suppress your body’s natural production of melatonin, the hormone that signals it’s time to sleep. Harvard Health recommends avoiding bright screens for two to three hours before bed. If that’s not realistic (and for most people it isn’t every night), at least dim your screen brightness, use a warm-toned night mode, and avoid content that’s emotionally activating. Scrolling through stressful news or engaging social media is far worse for sleep than watching a familiar, low-stakes show.

Overhead lights matter too. Switching to dim lamps or warm-toned bulbs in the hour before bed gives your brain the darkness cue it needs to start winding down.

Melatonin Supplements: What to Know

Melatonin can help if your sleep timing is off, like after travel or a schedule change. The effective dose is lower than most people think. UC Davis Health recommends starting at just 1 mg and increasing by 1 mg per week if needed, up to a maximum of 10 mg. More is not better. Higher doses can actually cause grogginess, headaches, and disrupted sleep.

There’s a significant quality control problem worth knowing about. A 2023 study published by the American Medical Association tested 25 melatonin gummy products and found that 88% were inaccurately labeled. The actual melatonin content ranged from 74% to 347% of what the label claimed. Because melatonin is sold as a dietary supplement rather than a regulated medication, there’s no FDA approval process ensuring accuracy or safety.

Short-term use (one to two months) appears safe for most adults. Long-term effects haven’t been well studied, so it’s worth taking periodic breaks to reassess whether you still need it.

Magnesium as a Sleep Aid

Magnesium plays a role in the chemical processes that help your nervous system calm down. Many people don’t get enough from their diet, and supplementing can improve sleep quality. Mayo Clinic Press recommends 250 to 500 mg taken as a single dose at bedtime. Magnesium glycinate is a good choice because it’s gentle on the stomach. Magnesium oxide is cheaper but more likely to cause loose stools, which can actually be helpful if constipation is also an issue for you.

The effects aren’t dramatic like a sleeping pill. Magnesium tends to work gradually over days to weeks, making it easier to relax and stay asleep rather than knocking you out.

Building Better Sleep Over Time

If you can’t sleep on a regular basis, the habits surrounding your sleep matter more than any single technique. A few changes make the biggest difference. Wake up at the same time every day, even on weekends. This anchors your body’s internal clock more powerfully than any other single habit. Avoid caffeine after early afternoon; its effects last six to eight hours in most people, and longer if you’re a slow metabolizer. Get bright light exposure in the morning, ideally sunlight, which helps set the timing of your melatonin release later that night.

Reserve your bed for sleep and sex only. Working, eating, or watching TV in bed weakens the mental association between the bed and sleep. Over weeks, these changes compound. The goal isn’t perfect sleep every night. It’s building a pattern where your body reliably knows when it’s time to wind down.