Somnera
The middle of the night

Insomnia and anxiety: which one do you treat first?

Everyone says it is bidirectional and then stops. The evidence points at an order of operations, and it is not the one most people assume.

5 min read

Last reviewed September 2, 2026

Two ringed points joined by a pair of arcs that loop between them, one heavier than the other.

Share

Every article on this says the relationship is bidirectional and then stops, which leaves you exactly where you started. The evidence supports a more useful answer.

The direction people miss

That anxiety disturbs sleep is obvious. The reverse is better evidenced than most people realise.

A meta-analysis of twenty-one longitudinal studies found that people with insomnia at baseline had roughly 2.6 times the odds of developing depression later (95% CI 1.98 to 3.42) compared with people sleeping normally.

For anxiety specifically, a Norwegian cohort of over 25,000 people followed for eleven years found that insomnia at the first survey was associated with an odds ratio of 3.4 (95% CI 3.1 to 3.8) for developing an anxiety disorder by the second. For people with insomnia at both timepoints it was 4.9.

These are associations, not proof of causation. But the temporal order is the point: the insomnia came first, and the anxiety followed.

Which means treating insomnia purely as a symptom - something that will clear up once the real problem is dealt with - is not well supported by the data.

Why "fix the anxiety first" often stalls

It is the intuitive order and there is a specific reason it disappoints.

Insomnia may start with anxiety and does not stay there. Within weeks it acquires its own maintaining machinery: extra time in bed to compensate, a bed that now reliably produces alertness, a body clock loosened by a variable rising time, and the effortful trying that makes sleep less likely, not more.

None of that machinery is anxiety. Treating the anxiety does not dismantle it, which is why people finish a course of therapy feeling better in themselves and still lying awake at 2am - and conclude, wrongly, that the insomnia must be permanent.

It is not permanent. It has just become its own problem and needs its own intervention.

What happens when sleep is treated directly

Several large randomized trials have tested exactly this, and the results are consistent enough to state plainly - and modest enough that overstating them would be dishonest.

The largest was a trial of digital CBT-I in over 3,700 university students. At ten weeks the effect on insomnia was large. Depression and anxiety symptoms also improved - with small effect sizes. Real, measured, and much smaller than the sleep effect.

A second trial of over 1,700 people compared digital CBT-I with sleep hygiene education and looked at functioning and wellbeing rather than sleep. Both improved, and the analysis found that improvement in insomnia mediated between about 45% and 84% of those gains - meaning the sleep improvement was the route through which the rest happened.

Pooling across twenty-two randomized trials of digital CBT-I, anxiety symptoms improved with a standardised mean difference of -0.29 (95% CI -0.40 to -0.19) and depression symptoms by -0.42 (95% CI -0.56 to -0.28). Small to moderate. Reliably different from zero.

One thing worth being straight about, because it is often reported carelessly: a trial that tested whether an online insomnia program could prevent episodes of major depression did not find that it did - nine cases against thirteen in the control arm, not a significant difference. Improving depressive symptoms and preventing a depressive episode are different claims, and only the first is supported.

Take the free assessment to see:

  • Your Insomnia Severity Index (ISI) score
  • A personalized 6-week CBT-I plan, built by a sleep physician
  • How your sleep improves, night by night
Start free assessment

So what is the order of operations?

For most people with both, treating the insomnia directly is worth doing rather than deferring - because it does not require the anxiety to be resolved first, because the insomnia has become self-sustaining, and because sleep improvement carries a modest benefit for the anxiety rather than the other way around.

That is not "treat insomnia instead of anxiety". Both can and often should be addressed. It is an argument against the very common sequence of waiting - putting sleep aside until the anxiety is handled, and finding a year later that the sleep never came back on its own.

The European guideline is explicit that CBT-I is first-line for chronic insomnia in adults of any age including patients with comorbidities. Having something else going on is not a reason to skip it.

Telling them apart

Not a diagnosis - a rough sort.

Pointing at insomnia: the worry is about sleep and its consequences. It fades on nights you sleep well. Daytimes are fine when the night was. The dread starts in the evening.

Pointing at an anxiety disorder: it is present through the day. It attaches to many things - work, health, people - not only tonight. It is there after a good night. There is physical anxiety without an obvious subject.

Plenty of people have both, and that is normal rather than a complication.

What this program is and is not

Somnera addresses insomnia. It is not a treatment for an anxiety disorder, and nothing above should be read as suggesting a sleep program substitutes for care from a clinician.

If the anxiety is significant - if it is limiting what you do, if it comes with panic, if there is any concern about your safety - that needs someone looking at it properly, and sooner rather than after six weeks of sleep work.

Raising both in one appointment is a reasonable thing to do, and two weeks of sleep diary makes half of that conversation concrete.

More in the middle of the night.

Somnera is a self-guided education program built on CBT-I, founded and written by Dr. Camilo Ruiz, DO, FACOI, FAASM. It is not a diagnosis and does not replace care from your own clinician. The assessment is free and takes about two minutes.

Citations

  • Baglioni C, et al. Insomnia as a predictor of depression: a meta-analytic evaluation of longitudinal epidemiological studies. J Affect Disord. 2011;135(1–3):10–19. doi:10.1016/j.jad.2011.01.011
  • Neckelmann D, Mykletun A, Dahl AA. Chronic insomnia as a risk factor for developing anxiety and depression. Sleep. 2007;30(7):873–880. doi:10.1093/sleep/30.7.873
  • Freeman D, et al. The effects of improving sleep on mental health (OASIS): a randomised controlled trial with mediation analysis. Lancet Psychiatry. 2017;4(10):749–758. doi:10.1016/S2215-0366(17)30328-0
  • Espie CA, et al. Effect of digital cognitive behavioral therapy for insomnia on health, psychological well-being, and sleep-related quality of life: a randomized clinical trial. JAMA Psychiatry. 2019;76(1):21–30. doi:10.1001/jamapsychiatry.2018.2745
  • Lee S, et al. Digital cognitive behavioral therapy for insomnia on depression and anxiety: a systematic review and meta-analysis. npj Digit Med. 2023;6:52. doi:10.1038/s41746-023-00800-3
  • Christensen H, et al. Effectiveness of an online insomnia program (SHUTi) for prevention of depressive episodes (the GoodNight Study). Lancet Psychiatry. 2016;3(4):333–341. doi:10.1016/S2215-0366(15)00536-2
  • Riemann D, et al. The European Insomnia Guideline: an update 2023. J Sleep Res. 2023;32(6):e14035. doi:10.1111/jsr.14035

Frequently asked questions

Both, but the direction people overlook is the second one. In a large cohort followed for eleven years, insomnia at baseline was associated with more than triple the odds of developing an anxiety disorder later. Insomnia is not only a symptom.

It is the intuitive order and often the slower one. Insomnia frequently persists after anxiety is treated, because by then it has its own maintaining machinery - time in bed, conditioned arousal, sleep effort - which anxiety treatment does not address.

Modestly and measurably. Across randomized trials of digital CBT-I, anxiety symptoms improved with a small-to-moderate pooled effect. The effect on sleep is much larger than the effect on anxiety - which is the honest way to put it.

No. It is a treatment for insomnia that appears to have downstream effects on mood and anxiety symptoms. An anxiety disorder needs its own care from a clinician.

A rough test: if the worry is only about sleep and its consequences, and it fades on nights you sleep well, that points at insomnia. If it is present during the day, attaches to many things, and is there regardless of last night, that points at anxiety.