How to Sleep Better With Anxiety and Depression

Sleeping well when you’re dealing with anxiety, depression, or both is genuinely difficult, and there’s a biological reason for that. These conditions don’t just affect your mood during the day. They hijack the same stress and hormone systems your body relies on to fall asleep and stay asleep. About 60% of people with both a mood disorder and an anxiety disorder report at least one significant insomnia symptom, compared to roughly 45% of people dealing with either condition alone. The good news is that targeted strategies, from breathing techniques to structured therapy, can break the cycle.

Why Anxiety and Depression Disrupt Sleep

Your body runs on a stress hormone cycle that normally peaks about 30 to 45 minutes after you wake up and declines steadily throughout the day, reaching its lowest point around bedtime. That decline is what helps you feel drowsy at night. In people with anxiety or depression, this system stays chronically activated. Research shows that people with insomnia have a higher number of stress hormone pulses throughout a full 24-hour period compared to good sleepers, meaning their bodies never fully shift into rest mode.

Sleep loss makes this worse. Studies have found that sleep deprivation leads to higher baseline stress hormone levels and an amplified hormonal response when something stressful happens. Your body becomes more reactive to stress and slower to recover from it, which feeds back into more anxious thoughts at night and deeper depressive symptoms during the day. This creates a self-reinforcing loop: poor sleep increases emotional reactivity, which increases depression and anxiety, which makes sleep harder.

Depression also disrupts melatonin, the hormone that signals your body it’s time to sleep. People with depression tend to have lower nighttime melatonin levels and a flattened rhythm, meaning their bodies lose the sharp contrast between daytime alertness and nighttime sleepiness. Delayed melatonin timing has been linked to more severe depressive and emotional symptoms, particularly in younger adults.

Calm Your Nervous System Before Bed

The most immediate thing you can do is activate your body’s relaxation response before you try to sleep. Slow, deep breathing with a longer exhale than inhale shifts your nervous system from its alert, fight-or-flight mode into a calmer state. The 4-7-8 technique (inhale for 4 counts, hold for 7, exhale for 8) has been studied for this purpose. Research in healthy adults found that this breathing pattern significantly increased parasympathetic nervous system activity, the branch responsible for slowing your heart rate and relaxing your muscles. It also increased the brain wave patterns associated with calm and drowsiness.

You don’t need to follow the 4-7-8 ratio exactly. The key principle is that your exhale should be longer than your inhale. Even breathing in for 4 counts and out for 6 or 8, without holding, can produce similar calming effects. Try this for five to ten minutes while lying in bed with your eyes closed.

Deal With Racing Thoughts Early

Anxiety tends to flood your mind with worries the moment your head hits the pillow, partly because it’s the first quiet moment of the day. A technique called constructive worry can help, but it works best when you do it hours before bed rather than in the moment. Set aside 15 to 20 minutes in the early evening and write down everything you’re worried about. For each item, ask yourself two questions: is this something I can actually control, and if so, what’s one step I can take tomorrow? For worries you can’t control, simply writing them down externalizes them. The goal isn’t to solve every problem. It’s to give your brain the signal that these concerns have been acknowledged and don’t need to be processed at midnight.

If thoughts still intrude at bedtime, avoid engaging with them. Instead, redirect your attention to something sensory: the feeling of your breath, the weight of your blanket, or a simple mental image like walking through a familiar place. The more you practice this redirection, the faster your brain learns that bed is not the place for problem-solving.

CBT for Insomnia Works for Mood Disorders Too

Cognitive Behavioral Therapy for Insomnia, known as CBT-I, is the most effective non-medication treatment for sleep problems tied to anxiety and depression. It’s not traditional talk therapy. It’s a structured program, typically lasting four to eight weeks, that retrains your sleep habits and the thought patterns that keep you awake. A systematic review across 18 studies found it was more effective than medication or general sleep hygiene advice for people with depression and insomnia together.

What makes CBT-I particularly valuable is that improving sleep through this method also reduces depression and anxiety symptoms on their own. One large analysis found moderate to large reductions in anxiety symptoms and a meaningful decrease in depressive symptoms after completing the program. People who stuck with the program more consistently saw bigger improvements across all three areas: sleep, depression, and anxiety.

You don’t necessarily need an in-person therapist. Fully automated digital CBT-I programs, delivered through apps or websites with no human therapist involved, have also shown significant effects on depression, anxiety, and insomnia. Programs like Sleepio and Insomnia Coach (free for veterans) follow the same core protocol. If you can access a therapist, in-person delivery has the strongest evidence, but digital options are a real alternative.

Exercise Timing and Sleep

Regular physical activity improves sleep quality in people with depression and anxiety, but the timing matters for some people. Exercise releases brain chemicals that increase alertness and raises your core body temperature, both of which can interfere with falling asleep if you work out too close to bedtime. After exercise, your body temperature takes about 30 to 90 minutes to drop back down, and that cooling process is what helps trigger sleepiness.

If you notice that evening workouts keep you wired, try finishing exercise at least one to two hours before bed. That said, some people sleep perfectly well after late workouts. Pay attention to your own response rather than following a rigid rule. The most important thing is that you exercise regularly at whatever time you’ll actually do it.

Adjust Your Sleep Environment

Weighted blankets have gained popularity for anxiety-related sleep problems, and the research supports their use. Multiple studies show that weighted blankets improve sleep quality, shorten nighttime awakenings, and reduce self-reported stress in people with sleep disorders. One study found that using a weighted blanket increased salivary melatonin levels, offering a possible explanation for why they help with sleep onset. A blanket weighing roughly 10% of your body weight is the general recommendation.

Beyond that, standard environmental adjustments matter more when anxiety and depression are involved. Keep your bedroom cool (around 65 to 68°F), dark, and reserved for sleep. If you associate your bed with lying awake and worrying, that association strengthens over time. One core CBT-I principle is stimulus control: if you’ve been lying awake for roughly 20 minutes, get up, go to a dimly lit room, and do something low-stimulation until you feel sleepy again. This breaks the learned connection between your bed and wakefulness.

Magnesium as a Sleep Support

Magnesium plays a direct role in calming the nervous system. In the brain, it enhances the activity of GABA receptors, which are the same receptors targeted by many anti-anxiety medications. GABA is your brain’s primary “slow down” signal, reducing neuronal excitability and promoting relaxation. Many people with anxiety and depression are mildly deficient in magnesium without knowing it.

A randomized, placebo-controlled trial found that 250 mg of elemental magnesium (taken as magnesium bisglycinate) daily for 28 days produced modest but statistically significant improvements in insomnia symptoms in adults with self-reported sleep problems. This particular form pairs magnesium with glycine, an amino acid that has its own calming properties, delivering about 1,500 mg of glycine alongside the magnesium. Take it about an hour before bed for the best effect on sleep onset.

How Antidepressants Affect Your Sleep

If you’re taking medication for anxiety or depression, it may be contributing to your sleep problems. SSRIs, the most commonly prescribed antidepressants, can reduce sleep continuity and suppress the deep, restorative dream stage of sleep. Some people on SSRIs experience more nighttime awakenings or vivid dreams, particularly in the first few weeks.

Not all antidepressants affect sleep the same way. Some medications prescribed for depression, particularly those with sedating properties, actually improve sleep continuity and help with falling asleep faster. If your current medication is worsening your sleep, this is worth raising with your prescriber. Sometimes a small adjustment in timing (taking the medication in the morning instead of at night, or vice versa) can make a noticeable difference. The research emphasizes that when sleep-promoting antidepressants are used, low doses taken well before bedtime, combined with behavioral strategies like CBT-I, produce the best results.

Building a Nightly Routine That Works

The strategies above work best when combined into a consistent pre-sleep routine. A practical sequence might look like this:

  • Early evening: Complete a constructive worry exercise. Get your worries on paper and out of your head.
  • One to two hours before bed: Dim the lights, stop screen use or switch to a blue-light filter, and take magnesium if you’re using it.
  • In bed: Practice slow breathing with extended exhales for five to ten minutes. Focus on the physical sensations of breathing rather than trying to force sleep.
  • If still awake after 20 minutes: Get up, move to another room, and return only when drowsy.

Consistency matters more than perfection. Your body’s internal clock strengthens when you go to bed and wake up at the same times each day, including weekends. This regularity helps restore the melatonin rhythm that depression tends to flatten. Over time, a predictable routine teaches your brain that these cues mean sleep is coming, reducing the hyperarousal that keeps you staring at the ceiling.