Back to Blog
Sleep Stress10 min read

How to Sleep With Anxiety: 7 Techniques That Actually Work Tonight

You lie down. Your body is exhausted. And then your brain decides 11:42 PM is the perfect time to replay that conversation from 2014, audit your finances, and rehearse a deposition you do not have. By the time the racing slows, it is 2 AM and you have to be up at 6.

If this is your nightly pattern, you are not lazy, broken, or weak. You are caught in one of the most stubborn loops in mental health: anxiety disrupts sleep, poor sleep amplifies anxiety, and the dread of another bad night becomes the thing keeping you awake. About 20% of US adults live with this loop. The good news: it is one of the most treatable sleep problems if you stop fighting it the way most people do.

What Anxiety Does to Your Sleep, Physiologically

Anxiety is not just a feeling. It is a hormonal and nervous-system state that is biochemically incompatible with sleep.

When you are anxious, your sympathetic nervous system (the fight-or-flight branch) is dominant. Cortisol stays elevated, heart rate variability drops, and your body operates as if a real threat is present. Sleep requires the opposite: parasympathetic dominance, a cortisol nadir, and a sense of safety.

The HPA axis, your stress-hormone system, evolved for short bursts of activation followed by recovery. Modern anxiety keeps it running 16 hours a day. By the time bedtime arrives, your body has been priming for action since you opened your phone at 7 AM. Asking it to switch off in 15 minutes is biologically unrealistic.

A 2023 review in Sleep Medicine Reviews found that people with anxiety disorders take 35-45% longer to fall asleep than non-anxious controls and have 2-3 times more nighttime awakenings. The disruption is most severe in REM sleep, the stage where emotional memories get processed. Less REM means more raw, unprocessed worry the next day, which fuels the next night's anxiety.

Why Most Anxiety-and-Sleep Advice Fails

A quick search returns the same generic list: chamomile tea, lavender, deep breathing. These are not wrong, but they are not enough for clinical anxiety, and they create a frustrating feeling that something is wrong with you when they do not work.

The missing context: anxiety-driven insomnia is maintained by hyperarousal and conditioning. Your bed has become a place where anxiety happens, so your brain now activates anxiety the moment you lie down. Adding a chamomile tea on top of a conditioned anxiety response is like trying to whisper over a fire alarm.

The approaches below address both layers. The first three calm acute physiological arousal. The next three break the conditioning. The last is the one that actually changes your sleep long-term.

1. Physiological Sigh (90 Seconds, Works Fast)

Developed by Stanford neuroscientist Andrew Huberman's lab, the physiological sigh is the fastest known way to drop sympathetic activation in real time.

Double-inhale through your nose (one long inhale, then a sharp top-up inhale to fully fill the lungs), then a long, slow exhale through the mouth. Repeat 1-3 times. The double inhale reopens collapsed alveoli, the long exhale activates the vagus nerve, and the result is an immediate drop in heart rate within seconds.

This is not a calming meditation. It is a hardware-level reset. Use it when your heart is pounding and you cannot get the racing to stop. It works for panic-level activation in under two minutes.

For a deeper protocol, try the 4-7-8 breathing technique once you are calmer. The physiological sigh is the emergency brake. 4-7-8 is the cool-down lap.

2. Cognitive Shuffling Beats Counting Sheep

Counting sheep does not work because it is too predictable. Your anxious brain happily monitors the count while continuing to spiral. Cognitive shuffling, developed by cognitive scientist Luc Beaudoin, works because it makes your brain do the kind of disorganized association that happens just before sleep.

Pick a neutral word like "cinnamon." Take the first letter, C, and visualize as many things starting with C as you can: candle, cat, canyon, coffee, cobweb. When you run out, move to I, then N, and so on. The trick is the visualization, not the listing. Each image must be vivid and brief.

What happens: your prefrontal cortex, which generates anxious narrative, gets occupied with random imagery. Your default-mode network, which fuels rumination, drops out. Within 5-10 minutes, most people drift off mid-letter.

For more techniques to interrupt rumination at night, see our guide on how to stop racing thoughts.

3. The Worry Window

If you find yourself problem-solving in bed at 1 AM, you have not given your anxiety its appointment yet, so it shows up uninvited.

Schedule 15-20 minutes earlier in the evening, ideally before dinner, as your designated worry window. Sit with a notebook. Write every concern, however irrational. For each, note one of three categories: "Action I can take this week," "Action that has to wait," or "Out of my control." For the first category, schedule the action. For the others, write "parked" next to it.

This is not toxic positivity. You are not trying to feel better. You are externalizing the worry so your brain stops carrying the loop.

When the worry shows up at 1 AM, you have a script: "This was on the list. It is parked. I will return to it tomorrow." The first few nights this feels weak. By night five, the worries themselves quiet down because they know they have an appointment.

4. Get Out of Bed (The Counter-Intuitive Move)

This is the single most evidence-backed piece of advice for anxious insomnia, and the one that feels worst.

If you have been lying awake for more than 20 minutes, get up. Go to another room. Read something boring in dim light. No screens. No problem-solving. Return to bed only when sleepy.

Why this works: your bed is currently associated with anxiety because every night your brain rehearses being anxious in it. Stimulus control therapy, a core component of CBT-i, breaks that association. Within 1-2 weeks, your bed becomes a place for sleep again, not a place for worry.

The rule is hard the first three nights. By night seven, most people are falling asleep faster than they have in years. American Academy of Sleep Medicine guidelines list stimulus control as a first-line treatment for chronic insomnia, with effect sizes that match or exceed sleeping pills.

5. Cool the Room and the Body

Anxious bodies run hot. Cortisol elevates core body temperature. Sleep requires that temperature to drop by 1-2°F.

Drop your bedroom to 60-67°F (15-19°C). Take a warm shower or bath 60-90 minutes before bed. The peripheral warming dilates blood vessels, accelerating heat loss after the bath ends, and your core temperature falls more sharply than it otherwise would.

For anxious sleepers specifically, this matters more than for the average person. The cool environment plus the temperature crash gives a parasympathetic shove that anxiety alone cannot override.

6. Magnesium Glycinate, Specifically

Magnesium is one of the few supplements with consistent data for both anxiety and sleep, but the form matters. Magnesium oxide, the cheapest form, has 4% bioavailability and mostly causes loose stools. Magnesium glycinate is bound to glycine, which itself has calming neurotransmitter effects, and absorbs at 80%+.

A 2022 meta-analysis in Nutrients found magnesium supplementation reduced anxiety scores by an average of 0.34 standard deviations and improved sleep onset latency by 17 minutes in deficient adults. The effect was stronger when combined with vitamin B6.

Dose: 200-400 mg of glycinate, 1-2 hours before bed. Not L-threonate, not citrate, not oxide. See our magnesium for sleep guide for the details on form and timing.

Magnesium will not fix anxiety alone. It will lower the floor enough that the techniques above have a chance.

7. CBT-i: The Treatment Sleep Doctors Actually Recommend

Cognitive Behavioral Therapy for Insomnia (CBT-i) is the gold-standard sleep therapy and the only intervention that produces lasting changes. It combines stimulus control, sleep restriction, cognitive restructuring of anxious sleep beliefs, and progressive muscle relaxation.

A 2021 systematic review in JAMA Internal Medicine compared CBT-i to sleeping pills across 22 randomized trials. CBT-i matched or beat medication on every outcome and was the only treatment whose benefits persisted after stopping. Sleeping pills produce dependence and rebound insomnia. CBT-i builds skills.

The American Academy of Sleep Medicine recommends CBT-i as first-line treatment for chronic insomnia ahead of any pharmacological option. The catch: most people with anxious insomnia have never been offered it. Sleep specialists are scarce, and primary care physicians default to medication.

Digital CBT-i programs deliver the same results in 6-8 weeks for a fraction of the cost. SleepCodex's program is a structured CBT-i implementation with daily lessons, sleep restriction protocols tailored to your chronotype, and the cognitive techniques that target anxious sleep beliefs specifically.

What Will Not Help (And Might Make It Worse)

A few interventions are popular but counterproductive for anxious insomnia:

  • Melatonin at high doses. Melatonin is a circadian timing signal, not a sedative. 0.3-0.5 mg can help with phase shifts. The 5-10 mg gummies most people use cause grogginess and downregulate your own production.
  • Alcohol. A glass of wine sedates you, then fragments your sleep in the second half of the night when alcohol metabolism produces stimulating byproducts. Anxious sleepers feel the rebound the worst.
  • Cannabis as a long-term aid. THC suppresses REM sleep, the stage where emotional processing happens. Daily use over months tends to worsen baseline anxiety, not improve it.
  • Checking your sleep tracker every morning. A 2023 study coined the term "orthosomnia" for anxiety caused by sleep data. If you wake up feeling rested then check the score and feel worse, the tracker is hurting you.

When to Get Professional Help

See a doctor or therapist if:

  • Anxiety is interfering with work, relationships, or basic function
  • You are using alcohol or substances to sleep more than 2-3 nights a week
  • You have had insomnia for more than 3 months despite trying behavioral techniques
  • Panic attacks happen at night
  • You feel hopeless or are having thoughts of self-harm

Anxiety disorders are highly treatable. The sleep problem will not resolve until the underlying anxiety is addressed, and CBT-based therapy plus, in some cases, short-term medication is the right path. Behavioral techniques alone are not enough for severe anxiety, and there is no shame in needing more.

The Order of Operations Tonight

If you are reading this at 11 PM with a busy mind, here is the sequence:

  1. Right now: physiological sigh, three rounds
  2. Get up and write your worries on paper for 10 minutes
  3. Take 200 mg magnesium glycinate if you have it
  4. Cool the bedroom to 65°F
  5. Get into bed only when you feel sleepy, not just tired
  6. If awake after 20 minutes, get up and read something boring
  7. Tomorrow: schedule a 15-minute worry window for 6 PM

None of these will fix chronic anxiety. They will give you a survivable night while you build the longer-term fix.

Build the Long-Term Fix

Anxious insomnia responds best to a structured plan that combines stimulus control, sleep restriction, and the cognitive work that targets sleep-related anxiety specifically. That is exactly what CBT-i delivers, and it is what our 7-week program is built around.

Take our free 2-minute sleep quiz to find your sleep type and get a personalized plan that addresses your specific pattern, whether that is racing thoughts, mid-night wakings, or the can't-fall-asleep-can't-stay-asleep loop. The plan is built on the same protocols sleep clinics use.

Struggling with sleep? Find your sleep type.

Take our free 2-minute quiz and get a personalized plan.

Take the Sleep Quiz