Insomnia: Which Blood Tests Find the Cause of Poor Sleep

KH
Kyrylo Holovchenko
Kyrylo Holovchenko — founder of HealthLab, developer of the lab tracking and medication app.
Published: May 29, 2026 · Updated: May 29, 2026

You go to bed at a sensible hour, skip afternoon coffee, leave your phone outside the bedroom — and still cannot fall asleep. Or you fall asleep but wake at three in the morning, thoughts racing, and lie there until the alarm goes off. Or you spend eight hours in bed and wake up feeling as though you barely slept at all.

Insomnia is one of the most common health complaints: chronic insomnia affects an estimated 10–15% of adults. And the most important thing to say upfront, honestly, is this: in the majority of cases, the cause is not in a blood test. Chronic insomnia is most often behavioural or psychological in origin — anxiety, depression, poor sleep hygiene, an irregular schedule, too much caffeine or alcohol, excessive screen time, or shift work. The gold-standard treatment for chronic insomnia, as recommended by the American Academy of Sleep Medicine (AASM), is cognitive behavioural therapy for insomnia (CBT-I) — not sleeping pills, and not blood panels.

That said, a minority of cases do have a concrete medical contributor: thyroid dysfunction, iron deficiency with restless legs syndrome, night-time blood sugar swings, low vitamin D, or magnesium deficiency. These are straightforwardly ruled out with a standard blood panel. If a cause is found, it can be addressed. If results come back normal, that too is useful information — it redirects attention toward the behavioural factors that are far more likely to be at play.

The screening minimum for insomnia

There is no need to test everything at once. But a targeted core panel covers the most common correctable medical contributors to poor sleep.

MarkerWhat it measuresWhat an abnormal result suggests
TSHThyroid functionLow → hyperthyroidism (agitation, racing heart, insomnia); high → hypothyroidism (can also disrupt sleep)
FerritinIron stores in the bodyLow → restless legs syndrome, which interferes with falling asleep
Vitamin DSerum 25(OH)DLow → deficiency, associated with reduced sleep quality
Fasting glucoseBlood sugar levelLow overnight → nocturnal hypoglycaemia; chronically high → fragmented sleep
Morning cortisolHPA axis activityDisrupted diurnal rhythm → difficulty falling asleep, early-morning waking
MagnesiumSerum magnesium levelLow → muscle twitching, heightened anxiety, disturbed sleep

A practical note: most of these can be measured from a single venous blood draw. Cortisol and glucose should be collected fasting in the morning — this is important for accurate interpretation.

Hormonal causes

Thyroid function (TSH)

The thyroid gland governs the metabolic rate of every cell in the body, and it directly influences neurological excitability and the sleep–wake cycle.

Hyperthyroidism (low TSH) is a classic cause of insomnia: a racing heart, inner agitation, a feeling of warmth, irritability. Falling asleep in this state is physiologically difficult — the nervous system is running at full throttle. Even subclinical hyperthyroidism, without overt symptoms, can meaningfully impair sleep quality.

Hypothyroidism (high TSH) is a less intuitive but equally relevant contributor. Some people with hypothyroidism report shallow sleep, frequent waking through the night, and a persistent sense of unrefreshing rest despite adequate time in bed. Hypothyroidism is also a risk factor for obstructive sleep apnoea.

TSH is the most sensitive screening marker for thyroid function — it responds to changes earlier than free T4. A full explanation of reference ranges, subclinical hypothyroidism, and when treatment is indicated is in the TSH: What the Test Shows and What’s Normal article.

Cortisol and the diurnal rhythm

Cortisol is the stress hormone — but it is equally the waking hormone. Under normal physiology, cortisol peaks in the early morning (around 8 a.m.), tapers steadily across the day, and reaches its lowest point at night. This rhythm is what allows the body to fall and stay asleep.

In chronic stress or HPA axis dysregulation, this diurnal pattern breaks down: cortisol remains elevated in the evening when it should be declining. The result is difficulty switching off at bedtime, a feeling that the mind simply will not quieten, and early-morning waking at 4 or 5 a.m. accompanied by anxious thoughts.

The test is morning cortisol, collected fasting between 7:00 and 9:00 a.m. One caveat: a single venous cortisol measurement provides limited information given the marker’s high variability. To assess the full diurnal rhythm, clinicians may request salivary cortisol at multiple time points (morning and evening) or 24-hour urinary cortisol. Interpretation requires clinical context.

Ferritin and restless legs syndrome

The link between iron and sleep quality is one of the best-documented in this area. Restless legs syndrome (RLS) is a neurological condition characterised by uncomfortable crawling, pulling, or tingling sensations in the legs during rest — particularly in the evening and at night. The only relief is movement. Falling asleep becomes a genuine ordeal.

Iron deficiency is one of the leading correctable risk factors for RLS. Iron is required for dopamine synthesis in the basal ganglia, and dopaminergic pathways are central to the pathophysiology of restless legs. The review by Allen et al. (Sleep Medicine, 2017) confirms that raising ferritin levels in patients with RLS and iron deficiency significantly reduces symptom severity.

One important nuance: haemoglobin can remain entirely normal while ferritin is already depleted — this is the “latent” phase of iron deficiency. For this reason, ferritin (not just a full blood count) should be checked when RLS or sleep-onset difficulties are present. Reference ranges and interpretation are covered in the Ferritin: Iron Stores and What the Test Shows article.

Vitamin D

The relationship between vitamin D and sleep quality is an active area of research. Vitamin D receptors are expressed in hypothalamic nuclei that regulate circadian rhythm and sleep. Low serum 25(OH)D is consistently associated with shorter total sleep duration and poorer sleep quality in observational studies — though direct causation has not been conclusively established.

By most estimates, 40–70% of adults in Central and Northern Europe have insufficient vitamin D at some point in the year. The consequences are broad — muscle weakness, low mood, reduced immune function — and may include disrupted sleep. Testing is straightforward and widely available. Reference ranges and the distinction between deficiency and insufficiency are explained in the Vitamin D: Levels, Deficiency and What It Means article.

Magnesium

Magnesium is involved in neuromuscular transmission and in the function of GABA receptors — the inhibitory neurotransmitter system that promotes relaxation and sleep. When magnesium is deficient, muscle cramps and twitches at night, heightened nervous excitability, and anxiety can all worsen sleep onset and continuity.

It is important to be honest about the evidence: studies on magnesium supplementation improving sleep in people who are not deficient are weak and inconsistent. Magnesium is potentially relevant as a sleep disruptor specifically in the context of confirmed deficiency — not as a general sleep aid. Taking magnesium supplements without measuring levels first is not a well-supported strategy.

The test is serum magnesium. One limitation: serum magnesium represents only about 1% of total body magnesium content and may appear normal even with intracellular depletion. Results should be interpreted alongside symptoms and clinical context.

Metabolic causes

Night-time glucose and nocturnal hypoglycaemia

Nocturnal blood sugar drops are an underappreciated cause of middle-of-the-night waking. When glucose falls below a certain threshold during sleep, the body triggers a counter-regulatory response — a surge of adrenaline and cortisol designed to restore blood sugar. The person wakes up: anxious, heart pounding, hungry, sometimes sweating. Returning to sleep can be very difficult.

Nocturnal hypoglycaemia is most common in people with diabetes on insulin therapy or certain oral medications. But mild overnight glucose dips can also occur in people without diabetes — particularly after an evening of alcohol consumption, a late intense workout, or an extended fast.

In the other direction, chronically elevated glucose (prediabetes, type 2 diabetes) also fragments sleep: through nocturnal polyuria (frequent waking to urinate), through restless legs syndrome (which is more prevalent in diabetes), and through generally disrupted sleep architecture.

The test is fasting glucose. Reference ranges, prediabetes thresholds, and HbA1c interpretation are covered in the Blood Glucose: Normal Range, Prediabetes, and Diabetes article.

When blood tests are normal

Normal results are still results. They rule out the medical contributors listed above and redirect attention to what is, in the majority of people with chronic insomnia, the actual cause.

Sleep hygiene. An irregular sleep schedule (different bedtimes on weekdays versus weekends), bright screen exposure within one to two hours of sleep, a bedroom that is too warm (above 19–20°C), noise, caffeine after 2 p.m., alcohol in the evening (it creates a false sense of relaxation while significantly worsening the second half of the night) — each of these erodes sleep quality. Addressing them can resolve insomnia without any further intervention.

Anxiety and depression. Anxiety is the most common psychological cause of difficulty falling asleep. Depression is the most common cause of early-morning waking — waking at 4 or 5 a.m. unable to return to sleep is a classic depressive pattern. Both are highly treatable; there is no reason to delay seeking help if either is suspected.

Chronic stress and hyperarousal. Insomnia is often self-perpetuating. What started it may matter less than what now maintains it: the anxiety about not sleeping, the clock-watching during the night, the anticipatory dread of tomorrow. This cycle of hyperarousal is the central mechanism of chronic insomnia and is precisely what CBT-I is designed to break.

CBT-I (cognitive behavioural therapy for insomnia) is the first-line treatment for chronic insomnia per AASM guidelines — ahead of sleeping pills. It combines sleep restriction, stimulus control, relaxation techniques, and cognitive restructuring of unhelpful beliefs about sleep. The evidence is strong; the effects are durable; there are no side effects.

Obstructive sleep apnoea. If a person snores loudly, gasps during sleep, or a partner has witnessed pauses in breathing — this points to sleep apnoea, not simple insomnia. The characteristic daytime picture is excessive sleepiness despite apparently adequate time in bed, alongside morning headaches. Diagnosis requires polysomnography or home cardiorespiratory monitoring — blood tests play no role. Sleep apnoea carries significant cardiovascular risk and requires evaluation by a sleep specialist or ENT physician.

When to see a doctor urgently: insomnia has lasted more than three months and is significantly impairing daily function; there is reason to suspect sleep apnoea; thoughts of self-harm or suicide are present (insomnia can amplify suicide risk in the context of depression).

How HealthLab helps

A single test is a snapshot. A trend is understanding. Whether your ferritin climbed from 12 to 40 ng/mL after a course of iron supplements and your sleep improved — or your TSH has been quietly drifting downward over several years — the story only becomes visible in a chart.

HealthLab automatically recognises biomarkers from PDF lab reports issued by any laboratory — TSH, ferritin, vitamin D, glucose, cortisol, magnesium — and builds a trend chart over time. You see at a glance whether a marker is moving toward or away from normal after treatment. No manual data entry, no spreadsheets.

Download HealthLab on the App Store

Frequently Asked Questions

Do I need to run all these tests?

Not necessarily all at once. If there is a specific suspicion — restless legs in the evenings (check ferritin), or inner agitation and palpitations at night (check TSH) — a targeted test is a reasonable starting point. If symptoms are non-specific, a combined panel (TSH + ferritin + vitamin D + glucose) from a single blood draw covers the major correctable contributors efficiently.

My blood tests came back normal but I still can't sleep — what now?

This is the most common scenario, and it is not a dead end. Normal results rule out medical causes and point toward behavioural or psychological insomnia — which is the correct diagnosis for the majority of people with chronic poor sleep. The next step is referral to a clinician or psychologist trained in CBT-I (cognitive behavioural therapy for insomnia). This is the recommended first-line treatment: effective, durable, and without side effects.

Will magnesium help with insomnia?

Possibly — but only if you are actually deficient. The evidence for magnesium supplementation improving sleep in people with normal magnesium levels is weak. If a blood test confirms low magnesium and you have relevant symptoms (nocturnal muscle cramps, heightened anxiety, twitching), correcting the deficiency may help. Taking magnesium without testing first is not a well-supported approach and is not a substitute for addressing the underlying cause of insomnia.

How should I prepare for these tests?

Glucose and cortisol require a fasting morning collection (8–10 hours without food, water is fine; cortisol between 7:00 and 9:00 a.m.). Ferritin, TSH, vitamin D, and magnesium can follow a standard morning draw — a light breakfast is acceptable if glucose and cortisol are not part of the panel. Avoid testing during an acute illness: ferritin and cortisol can be falsely elevated by the inflammatory response. Wait 1–2 weeks after recovery for a representative result.

What does a borderline result mean?

“Borderline” does not mean “fine.” A ferritin of 14 ng/mL may technically fall within some laboratories’ reference ranges, but in the context of restless legs symptoms it is a reason to discuss with your doctor — not to file away and ignore. Context is everything: symptoms, diet, sex, chronic conditions. A clinician evaluates the full clinical picture, not just the number.


This article does not replace medical advice. Interpretation of blood test results and management of any sleep disorder require clinical context and guidance from a qualified healthcare professional.

Track your lab results in HealthLab

Download on the App Store

Related

References

  1. NHS — Insomnia
  2. NIH ODS — Magnesium: Fact Sheet for Health Professionals
  3. PubMed — Allen et al. Restless legs syndrome and iron: review (Sleep Med 2017)
  4. AASM — Insomnia (Sleep Education)