What to Do if You Can’t Sleep: Proven Techniques

If you’re lying in bed unable to sleep, the most effective thing you can do is get up. It sounds counterintuitive, but staying in bed while awake trains your brain to associate your bed with frustration rather than rest. Leave the bedroom, do something quiet and non-stimulating for 15 to 20 minutes, then return only when you feel genuinely sleepy. This single habit, repeated consistently, is one of the most well-supported strategies in sleep medicine.

Beyond that one rule, there are several things you can do tonight and over the coming weeks to fall asleep faster and stay asleep longer.

Get Out of Bed After 20 Minutes

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. If you’re still awake, get up and go to another room. Read, listen to calm music, or do something low-key until you feel drowsy, then go back to bed. If sleep still doesn’t come, repeat the process. The key rule: don’t fall asleep on the couch. Your bed is the only place you sleep.

This technique is called stimulus control, and it works by breaking the mental link between your bed and the anxiety of not sleeping. Staying in bed and trying harder only ramps up frustration, which makes sleep even less likely. It can feel brutal the first few nights, but sticking with it retrains your brain to associate climbing into bed with falling asleep quickly.

Calm Your Nervous System With Breathing

Structured breathing slows your heart rate and activates the part of your nervous system responsible for rest and recovery. Two techniques are worth trying:

  • 4-7-8 breathing: Inhale through your nose for 4 seconds, hold for 7 seconds, exhale slowly through your mouth for 8 seconds. The long exhale is what triggers the calming response. Repeat for four cycles.
  • Box breathing: Inhale for 4 seconds, hold for 4 seconds, exhale for 4 seconds, hold again for 4 seconds. This is the same method used in military and first-responder training to manage acute stress.

Both techniques work by regulating your autonomic nervous system. Regular practice has been shown to reduce anxiety, lower blood pressure, and improve heart rate variability, a marker of overall cardiovascular and mental health. You don’t need to master these perfectly. Even a few cycles can shift your body out of the alert, wired state that keeps you staring at the ceiling.

Distract Your Racing Mind

The reason most people can’t sleep isn’t physical. It’s mental. You’re replaying a conversation, planning tomorrow, or worrying about something you can’t solve at 2 a.m. Your brain needs a task boring enough to let sleep take over but engaging enough to pull you away from those loops.

One surprisingly effective method is called the cognitive shuffle. Pick any random word, like “tree.” Now think of objects that start with T: towel, trumpet, turtle. Visualize each one briefly. Move to the next letter, R: rainbow, rug, robot. The images should be random, unrelated, and emotionally neutral. This technique was developed by cognitive scientist Luc Beaudoin, and it works because your brain interprets the jumble of unconnected images as the kind of thinking that happens right before sleep. You’re essentially faking the onset of dreaming.

Another option is to imagine yourself in a specific peaceful place, a beach, a forest, a cabin, and mentally explore the details: what you see, hear, smell, and feel. When your mind wanders back to your worries, gently redirect it to that scene. This is the visualization component of the military sleep method, which claims to help people fall asleep in about two minutes with practice.

Set Up Your Room for Sleep

Your bedroom environment has a direct effect on how quickly you fall asleep. Temperature matters most. Your body needs to cool down slightly to initiate sleep, and a warm room fights that process. The ideal bedroom temperature is between 60 and 67°F (15 to 19°C). If that feels cold, a warm shower before bed actually helps: it brings blood to your skin’s surface, which then radiates heat and drops your core temperature faster once you’re under the covers.

Darkness is equally important. Your brain produces melatonin, the hormone that signals it’s time to sleep, in response to darkness. Blue light, the type emitted by phone screens, tablets, and LED bulbs, is particularly effective at suppressing melatonin. Research published in the Journal of Applied Physiology found that blue light in the 446 to 477 nanometer range causes a dose-dependent suppression of melatonin, meaning the brighter the screen and the longer the exposure, the more your sleep hormone drops. Even relatively dim blue light can have a measurable effect.

The practical takeaway: put your phone away at least 30 minutes before bed, or at minimum use a red-shifted night mode. Keep your room as dark as possible. Blackout curtains or a sleep mask can make a noticeable difference if streetlights or early morning sun reach your windows.

What to Avoid Before Bed

Caffeine has a half-life of about five to six hours, meaning half the caffeine from your afternoon coffee is still circulating in your bloodstream at bedtime. If you’re sensitive to it, cut off caffeine by early afternoon. Alcohol is trickier because it makes you feel drowsy initially but fragments your sleep in the second half of the night, reducing the restorative deep sleep stages.

Heavy meals close to bedtime force your digestive system to work when your body is trying to wind down. Eating two to three hours before bed gives your stomach enough time. Exercise is beneficial for sleep overall, but intense workouts within an hour or two of bedtime can leave your body too revved up to settle.

When Sleeplessness Becomes a Pattern

Everyone has the occasional rough night. That’s normal. But if you’re struggling to fall or stay asleep at least three nights per week for three months or longer, and it’s affecting how you function during the day, that meets the clinical definition of insomnia disorder. At that point, the most effective treatment isn’t a pill. It’s cognitive behavioral therapy for insomnia, often called CBT-I.

CBT-I combines several of the strategies above, stimulus control, sleep scheduling, and techniques for managing the anxious thoughts that fuel sleeplessness, into a structured program typically lasting six to eight weeks. One of its core tools is tracking your sleep efficiency: the percentage of time in bed you actually spend sleeping, calculated by dividing total sleep time by total time in bed. If you’re spending nine hours in bed but only sleeping six, your sleep efficiency is about 67%. CBT-I works partly by temporarily restricting your time in bed to compress your sleep into a shorter, more efficient window, then gradually expanding it as your sleep improves.

CBT-I is available through therapists, sleep clinics, and several validated digital apps if in-person treatment isn’t accessible. It outperforms sleep medications in long-term studies because it addresses the behavioral and psychological roots of insomnia rather than masking symptoms.

Do Supplements Help?

Magnesium is the supplement with the most consistent signal for sleep. It plays a role in regulating your nervous system and muscle relaxation. A small randomized, placebo-controlled trial found that adults with poor sleep quality who took a magnesium supplement daily for two weeks showed improvements in both sleep quality and mood compared to placebo. Magnesium glycinate is the form most commonly recommended for sleep because it’s well absorbed and less likely to cause digestive issues than other forms.

Melatonin supplements can help if your sleep timing is off, such as after travel across time zones or if you’re a natural night owl trying to shift earlier. It’s less effective for general insomnia where the issue isn’t timing but the inability to relax. If you try melatonin, start with a low dose (0.5 to 1 mg) taken 30 to 60 minutes before your target bedtime. Many over-the-counter products contain 5 or 10 mg, which is far more than your body produces naturally and can cause grogginess or disrupt your sleep cycle further.