Why Anxiety Can Ruin Your Sleep (and What Helps)
Poor sleep with anxiety often comes from stress hormones staying high, conditioned insomnia, or thyroid/iron issues. Targeted labs available, no referral needed.

Poor sleep with anxiety usually happens because your body stays in “threat mode,” so stress hormones and alertness signals stay high at night, and your brain starts linking bed with worry instead of rest. It can also be driven by a fixable body issue such as an overactive thyroid or low iron, which makes your heart race and your legs or mind feel restless. A few targeted labs can help you tell the difference between “stress physiology” and a medical driver. This symptom is frustrating because it feeds itself: one bad night makes you anxious about the next, and that anxiety becomes the new trigger. You might feel tired but wired, fall asleep and then jolt awake at 3 a.m., or lie there doing mental math about how wrecked tomorrow will be. The good news is that you can usually break the cycle with a mix of habit changes that are more specific than generic “sleep hygiene,” plus the right kind of therapy approach, and sometimes a medical check. If you want help sorting which pattern sounds most like you, PocketMD can walk through your symptoms and next steps, and Vitals Vault labs can help you check common contributors without a referral.
Why anxiety can ruin your sleep
Your stress system stays switched on
When your body thinks you need to stay alert, it keeps releasing stress signals like cortisol and adrenaline, which makes your heart feel jumpy and your thoughts feel fast. That can delay sleep onset, but it also makes you more likely to wake up after a normal sleep-cycle shift and then struggle to drift back off. A helpful clue is timing: if you feel most wired in the evening and you wake up “on edge” rather than sleepy, your stress system is probably doing the driving.
Bed becomes linked with worry
After a few rough nights, your brain can start treating the bed like a place where you problem-solve, scroll, or brace for another bad night. That learned association is a big part of chronic insomnia, even when the original stressor has eased. The takeaway is counterintuitive but powerful: the fix is not trying harder to sleep, but retraining your brain so bed equals sleep again.
Nighttime panic and body sensations
Sometimes you are not “worrying” so much as reacting to a body jolt, like a sudden rush of heat, a pounding heart, or a feeling you cannot get a full breath. That can be a panic surge, but it can also be reflux, low blood sugar, or sleep apnea creating a stress response that feels like anxiety. If you regularly wake up gasping, choking, or with a racing heart, it is worth talking to a clinician because treating the trigger often improves sleep quickly.
Thyroid overdrive (hyperthyroidism)
An overactive thyroid speeds up your metabolism, which can feel like internal restlessness, sweating, tremor, and a heart that will not settle down at night. Even mild thyroid overactivity can make anxiety feel “chemical,” meaning it shows up even when life is calm. If your sleep got worse along with heat intolerance, unexplained weight loss, or frequent palpitations, a thyroid test is a practical place to start.
Low iron or magnesium makes you restless
Low iron stores can irritate your nervous system and contribute to restless legs, which is that uncomfortable urge to move that shows up right when you are trying to relax. Low magnesium does not cause anxiety for everyone, but it can make it harder for your muscles and nervous system to downshift, especially if you are under stress or using stimulants. If you notice leg crawling sensations, frequent muscle twitches, or you feel physically unable to “settle,” checking ferritin and magnesium can point to a fixable contributor.
What actually helps you sleep again
Use CBT-I rules, not willpower
Cognitive behavioral therapy for insomnia (CBT-I) works because it targets the two things that keep insomnia going: time awake in bed and fear of not sleeping. A simple starting rule is the 20-minute reset: if you are awake and frustrated, get out of bed and do something boring in dim light until you feel sleepy again. It feels annoying at first, but it teaches your brain that bed is for sleep, not for wrestling with thoughts.
Schedule worry time earlier
If your brain saves all its processing for 11 p.m., give it a container. Set a 10–15 minute “worry appointment” in the early evening where you write the worries down and add one next action for each, even if the action is “decide tomorrow.” When the thought pops up in bed, you can tell yourself, “That’s on the list,” which reduces the sense of urgency that keeps you awake.
Lower arousal with body-first tools
When anxiety is physical, thinking your way out often backfires, so start with your nervous system. Try a slow exhale pattern such as breathing in for 4 seconds and out for 6–8 seconds for five minutes, because longer exhales nudge your body toward the “rest and digest” mode. If you wake up panicky, put one hand on your chest and one on your belly and keep the exhale slow until the surge passes.
Protect your sleep drive
Long naps and sleeping in can feel like survival, but they reduce your sleep drive, which makes the next night lighter and more fragile. If you need a nap, keep it earlier in the day and under 20–30 minutes so you take the edge off without stealing from nighttime sleep. This one change often makes the biggest difference for people stuck in the “tired all day, wired at night” loop.
Use meds or supplements strategically
Short-term sleep aids can be useful when you are in a crisis, but nightly use can create rebound insomnia or morning fog, especially with antihistamines or alcohol. If you want to try magnesium glycinate, many people start around 100–200 mg in the evening and adjust based on loose stools or next-day grogginess, but it is not a cure for severe insomnia. If anxiety is the main driver, treating the anxiety directly with therapy and, when appropriate, prescription options is often more effective than stacking sleep products.
Useful biomarkers to discuss with your clinician
Cortisol, Total
Cortisol is the primary stress hormone that regulates metabolism, immune function, and blood pressure. In functional medicine, cortisol assessment is crucial for understanding stress response and its impact on overall health. Chronic elevation suppresses testosterone production and immune function, while low cortisol indicates adrenal insufficiency. Optimal cortisol rhythm supports energy, mood stability, and hormone balance. Cortisol orchestrates the body's stress response and daily energy rhythms. Balanced cor…
Learn moreTSH
TSH is the master regulator of thyroid function, controlling the production of thyroid hormones T4 and T3. In functional medicine, we use narrower TSH ranges than conventional medicine to identify subclinical thyroid dysfunction early. Even mildly elevated TSH can indicate thyroid insufficiency, leading to fatigue, weight gain, depression, and metabolic dysfunction. TSH levels are influenced by stress, nutrient deficiencies, autoimmune conditions, and environmental toxins. Optimal TSH supports energy, metabolism…
Learn moreFerritin
Ferritin is your body's iron storage protein, reflecting total iron stores in the body. In functional medicine, ferritin assessment is crucial for identifying both iron deficiency and iron overload, conditions that can significantly impact energy levels and overall health. Low ferritin is the earliest sign of iron deficiency, often occurring before anemia develops. This can cause fatigue, weakness, restless leg syndrome, and cognitive impairment. Conversely, elevated ferritin may indicate iron overload, inflamma…
Learn moreLab testing
Check thyroid, iron stores, and magnesium at Quest — starting from $99 panel with 100+ tests, one visit. No referral needed.
Schedule online, results in a week
Clear guidance, follow-up care available
HSA/FSA Eligible
Pro Tips
Try a two-week “sleep-anxiety log” where you write down your bedtime, estimated time to fall asleep, number of awakenings, and one sentence about what you were thinking or feeling in your body. Patterns show up fast, and that tells you whether to focus on CBT-I, panic surges, or a medical check.
If you are watching the clock, turn it away or charge your phone outside the bedroom, because time-checking trains your brain to treat wake-ups as emergencies. Your goal is to make awakenings boring again.
Pick a single wind-down routine that takes 20–30 minutes and keep it the same every night for a week, even if you do not feel sleepy. Repetition matters more than perfection because it becomes a cue for your nervous system.
If you wake up at the same time every night, do not immediately troubleshoot your life. Get up, use the bathroom if needed, keep lights low, and do a quiet activity until your eyelids feel heavy, then return to bed.
If you suspect restless legs, test it: when the urge to move hits, stand up and walk for two minutes. If it temporarily relieves the sensation and it keeps returning at rest, ferritin testing and iron repletion are worth discussing.
Frequently Asked Questions
Can anxiety really cause insomnia every night?
Yes. Anxiety can keep your stress system activated so your brain stays on alert, and after a while your brain can learn that bed equals wakefulness, which keeps insomnia going even on calmer days. That is why CBT-I strategies like getting out of bed when you are wide awake often work better than trying to “relax harder.” If this has been happening for more than 3 months, consider CBT-I plus a check for medical contributors like thyroid or iron issues.
Why do I fall asleep but wake up at 3 a.m. anxious?
A 3 a.m. wake-up often happens when a normal lighter sleep stage meets a stress surge, reflux, a drop in blood sugar, or breathing disruptions that your brain interprets as danger. You might notice a racing heart, sweating, or a sudden sense of dread even if you were not thinking about anything. If you also snore loudly, wake up gasping, or feel unrefreshed despite enough hours, ask about sleep apnea screening.
What blood tests help with anxiety-related insomnia?
The most useful “rule-out” labs are TSH for thyroid overactivity, ferritin for low iron stores that can drive restless legs, and RBC magnesium if you have muscle tension or twitching with poor sleep. For restless legs symptoms, many clinicians aim for ferritin above about 50 ng/mL. If any result is abnormal, the next step is confirming the cause and treating it rather than just adding another sleep aid.
Is melatonin good for anxiety and sleep?
Melatonin is best for shifting your sleep timing, like when your schedule is off, rather than for shutting down anxious thoughts. If you try it, lower doses often work better, such as 0.3–1 mg taken 1–2 hours before bed, because higher doses can cause vivid dreams or morning grogginess. If your main problem is waking up panicky, focus first on CBT-I rules and calming your nervous system during awakenings.
When should I worry that poor sleep with anxiety is something serious?
Get urgent help if you have chest pain, fainting, severe shortness of breath, or thoughts of harming yourself, because those need immediate support. On a less urgent level, it is worth a medical review if insomnia is new and severe, if you have unexplained weight loss with palpitations and heat intolerance (possible thyroid overactivity), or if you wake up gasping or choking (possible sleep apnea). Bring a one-week sleep log to make the visit more productive.
