How to Sleep With Severe Anxiety and Panic Attacks

Severe anxiety keeps you awake because your body is stuck in a state of high alert, flooding your system with stress hormones that directly block the deep, restorative stages of sleep. The good news: specific techniques can interrupt that cycle, and they work even on the worst nights. Some you can try tonight, others build over weeks, but all of them target the actual mechanisms keeping you wired at 2 a.m.

Why Anxiety Makes Sleep So Difficult

When anxiety is severe, your brain treats bedtime like a threat. Stress hormones rise, particularly cortisol and norepinephrine, and they peak at exactly the wrong time. People with insomnia tied to anxiety tend to have elevated cortisol levels in the evening and at sleep onset, precisely when those levels should be dropping. This isn’t just a vague “wired” feeling. Elevated cortisol reduces slow-wave sleep (the deepest, most physically restorative stage) and cuts into REM sleep (the stage critical for emotional processing and memory). Stress hormones also increase the brain’s electrical activity, pushing you toward lighter, more fragmented sleep even when you do drift off.

This creates a vicious loop. Poor sleep raises anxiety the next day, which raises cortisol the next night. If you’ve been dealing with this for months, you’re not imagining it getting worse. Sleep disturbance is one of the core symptoms of generalized anxiety disorder, and the diagnostic threshold is symptoms occurring more days than not for at least six months. But you don’t need a formal diagnosis to benefit from the strategies below.

Calm Your Nervous System Before Bed

The single most effective thing you can do tonight is shift your body out of fight-or-flight mode and into its rest-and-digest state. Slow, controlled breathing is the fastest lever you have. The 4-7-8 technique (inhale for 4 counts, hold for 7, exhale for 8) works because the long exhale directly stimulates the vagus nerve, which controls your parasympathetic nervous system. Research on this breathing pattern shows it measurably decreases sympathetic (stress) nervous system activity and increases parasympathetic output, essentially telling your heart rate and blood pressure to come down. Holding your breath briefly also increases oxygen saturation, which further dials back the body’s alarm signals.

You don’t need to do this perfectly. Sit or lie in bed, breathe in through your nose for four counts, hold for seven, and exhale slowly through your mouth for eight. Repeat four cycles. If the count feels too long at first, shorten proportionally but keep the exhale longer than the inhale. That ratio is what matters.

Progressive muscle relaxation is another technique rated as effective for chronic insomnia by the American Academy of Sleep Medicine. It takes 10 to 15 minutes and works by systematically tensing and releasing muscle groups, which forces your body to physically register what relaxation feels like. Start at your feet: tense the muscles for five seconds while breathing in, then release all at once and notice the contrast. Work up through your calves, thighs, abdomen, hands, arms, shoulders, and face. The rhythmic pattern of breathing and movement calms both body and mind, and it’s particularly useful when anxiety lives in your body as tension, jaw clenching, or a tight chest.

What to Do During a Nighttime Panic Attack

If you wake up in a full panic, with your heart racing, a sense of dread, or feeling disconnected from reality, grounding techniques pull you back into the present moment before the spiral takes over. Focus on what you can physically sense right now. Press your palms flat against the mattress and notice the texture. Feel the temperature of the air on your skin. Listen for any ambient sound, a fan, traffic outside, anything steady.

Structured breathing helps here too, but sometimes panic makes counting feel impossible. In that case, try five-finger breathing: spread one hand and use the index finger of your other hand to slowly trace up and down each finger, breathing in as you trace up and out as you trace down. It gives your brain a visual and tactile anchor. You can also picture a place that feels safe and calm, real or imaginary, and mentally walk through every sensory detail: what you’d see, hear, feel on your skin, and smell. This isn’t just distraction. It redirects your brain’s attention away from the threat-detection centers and toward sensory processing, which lowers arousal.

Restructure Your Relationship With the Bed

Cognitive Behavioral Therapy for Insomnia (CBT-I) is the gold-standard treatment for anxiety-related sleep problems, typically delivered over six to eight sessions. Two of its core techniques are things you can start applying on your own.

The first is stimulus control. If you’ve spent months lying awake in bed feeling anxious, your brain has learned to associate the bed with wakefulness and dread rather than sleep. To reverse this, follow one strict rule: only get into bed when you’re genuinely sleepy, and if you’re still awake after roughly 20 minutes, get up and go to another room. Do something low-stimulation (read a physical book, listen to a calm podcast) and return only when sleepiness hits. This feels counterintuitive and frustrating at first, but over days and weeks it retrains your brain to link the bed with sleep, not anxiety.

The second technique is sleep restriction, which sounds harsh but is remarkably effective. The idea is to match the time you spend in bed to the time you actually sleep. If you’re lying in bed for nine hours but only sleeping five, you’re spending four hours practicing being awake and anxious in bed. Sleep restriction narrows your window: pick a fixed wake-up time you can stick to every day, then set your bedtime by counting backward from that time by however many hours you currently average in actual sleep. If you sleep about five and a half hours and need to be up at 7:00 a.m., your bedtime is 1:30 a.m. When at least 85% of your time in bed is spent sleeping, you extend the window by 15 minutes. This builds up sleep pressure so that when you do get into bed, you fall asleep faster and stay asleep longer.

CBT-I also incorporates cognitive work, identifying and challenging catastrophic thoughts about sleep (“If I don’t sleep tonight, I’ll lose my job”). More recent versions include mindfulness training, which takes a different approach: instead of arguing with anxious thoughts, you simply notice them without engaging. Both strategies reduce the mental hyperarousal that keeps your brain scanning for threats at midnight.

Set Up Your Room for a Calmer Nervous System

Your sleep environment either helps or hurts thermoregulation, and thermoregulation is critical for staying in deep sleep. Keep your bedroom between 60 and 67°F (15 to 19°C). Above 70°F is too warm and will fragment your sleep, particularly the slow-wave stages that anxiety is already suppressing. Your core body temperature needs to drop slightly to initiate and maintain sleep, so a cool room works with that process rather than against it.

Darkness matters because light suppresses melatonin production. Blackout curtains or a sleep mask help, especially if you live in a city. Noise is trickier with anxiety because silence can amplify the sound of your own heartbeat or racing thoughts. A white noise machine or fan provides consistent, neutral sound that gives your brain something to process without triggering alertness.

Keep your phone outside the bedroom, or at minimum face-down with notifications off. This isn’t just about blue light. When you’re anxious and can’t sleep, the phone becomes an escape that delays sleep onset by hours. If you use your phone for an alarm, buy a cheap alarm clock instead.

How Anxiety Medications Affect Sleep Quality

If you’re already taking medication for anxiety, it’s worth knowing that some common prescriptions change your sleep architecture in ways you can feel. Antidepressants, particularly those that increase serotonin or norepinephrine, tend to delay the onset of REM sleep and reduce total REM time. This can mean more vivid dreams when REM does occur, or a feeling that sleep isn’t refreshing even when you log enough hours. Some antidepressants also increase periodic limb movements during sleep, which fragments your rest without fully waking you.

Anti-anxiety medications that target a different pathway (sedating types like trazodone or certain others prescribed off-label for sleep) can improve sleep efficiency and reduce time spent awake during the night. The trade-offs vary by medication. If you feel like your sleep got worse after starting or changing a medication, that’s a real and documented effect worth raising with your prescriber, not something to push through indefinitely.

Supplements That Have Some Evidence

Magnesium is the most-discussed supplement for anxiety and sleep, and there is some clinical support for it, though it’s modest. A study of adults with at least mild-to-moderate anxiety found that 300 mg of magnesium daily (mostly magnesium oxide with a smaller amount of magnesium bisglycinate) led to a significant drop in anxiety scores over four weeks, with over 40% of participants experiencing at least a 50% reduction. The combination also included fish protein hydrolysate and vitamin B6, so magnesium alone may account for only part of that effect.

Magnesium glycinate is the form most often recommended for sleep because it’s better absorbed and less likely to cause digestive issues than magnesium oxide. Dosing in studies has varied widely, from weight-based dosing in children (4 to 6 mg per kilogram of body weight) to flat doses of 200 to 400 mg in adults. Taking it about 30 minutes before bed is the most common approach. It’s not a sedative. It supports muscle relaxation and nervous system function, which may help you fall asleep more easily over time rather than knocking you out on night one.

Building a Nightly Routine That Works

The goal of a pre-sleep routine isn’t to make bedtime pleasant (though that can happen eventually). It’s to give your nervous system a consistent signal that the threat-scanning part of the day is over. Start winding down 60 to 90 minutes before your target bedtime. Dim the lights in your home. Do the same sequence of low-stimulation activities each night: a warm shower, a few minutes of reading, then your breathing exercises or progressive muscle relaxation in bed.

Consistency matters more than any single element. Your circadian rhythm responds to regularity. A fixed wake time, seven days a week, is the most powerful anchor. Even on terrible nights when you barely slept, getting up at the same time preserves sleep pressure for the following night. Sleeping in to “catch up” feels merciful in the moment but delays the reset your body needs.

If you’ve been struggling for more than a few weeks, a structured CBT-I program, either with a therapist or through a validated digital program, is more effective than any single technique in isolation. It combines all of the behavioral and cognitive strategies above into a system that typically produces lasting improvement within six to eight sessions. Unlike sleep medications, the benefits persist after you stop treatment because you’ve changed the underlying patterns driving the problem.