Sleep is disturbed by a great many medicines, and the usual response is to add something to help with sleep - which stacks a sedative on top of whatever caused the problem. A large proportion of drug-related insomnia is fixed instead by moving the dose to a different time of day. It is worth working out which medicine is responsible before reaching for a solution.
Medicines that keep you awake
Steroids are the clearest cause. Oral steroids commonly cause insomnia, agitation and vivid dreaming, and the effect is dose-related. Taking the dose in the morning mimics the body's natural rhythm and substantially reduces it. See prednisolone.
SSRIs and SNRIs frequently disturb sleep early in treatment, with vivid dreams and fragmented sleep. Fluoxetine is the most activating. Taking them in the morning usually helps - though some people find the opposite.
Beta blockers, particularly the fat-soluble ones such as propranolol, cause vivid dreams and nightmares by crossing into the brain and suppressing melatonin. Switching to a water-soluble one such as atenolol frequently resolves it. See propranolol.
Montelukast causes sleep disturbance, vivid dreams and nightmares, in children as well as adults, and carries a specific regulatory warning. See montelukast.
Salbutamol and theophylline, which are stimulant in effect.
Bupropion, ADHD stimulants, decongestants and caffeine in all its forms.
Diuretics taken late, which wake you to pass urine - moving them to first thing is the single most effective fix in this whole article. See furosemide.
Medicines that make you drowsy
The opposite problem, and it matters for driving.
Sedating antihistamines, including those hidden inside over-the-counter sleep aids and night-time cold remedies.
Opioids, benzodiazepines, Z-drugs and gabapentinoids.
Mirtazapine and trazodone, which are markedly sedating - and with mirtazapine, lower doses sedate more than higher ones.
Antipsychotics, muscle relaxants and some anti-epileptics.
Where sedation is the problem, moving the dose to bedtime frequently converts a side effect into an advantage.
See mirtazapine and medicines and driving.
Sleep disturbed by something else the medicine causes
Easy to miss, because the medicine is not acting on sleep directly.
Reflux from anything relaxing the lower oesophageal sphincter - theophylline, calcium channel blockers.
Cramps from diuretics or low magnesium.
Restless legs, which is worsened by antihistamines, several antidepressants and antipsychotics, and by iron deficiency.
Night sweats from antidepressants, steroids and hormone treatments.
Pain returning because a painkiller has worn off, which points to a longer-acting approach rather than a sleeping tablet.
Breathlessness when lying flat, which is a reason to seek assessment rather than to treat the sleep.
Withdrawal disturbs sleep too
Stopping or reducing several medicines causes insomnia and vivid dreams for days to weeks - antidepressants, benzodiazepines, opioids and gabapentinoids among them.
That is frequently misread as the original problem returning, which is how people get trapped on a sleeping tablet indefinitely.
Alcohol does the same: it shortens the time to fall asleep and then fragments the second half of the night.
See why you cannot just stop some medicines and alcohol and mental health medicines.
Timing is the first thing to try
Before anything else, ask whether each medicine is being taken at the best time of day.
Steroids in the morning. Diuretics first thing. Activating antidepressants in the morning. Sedating ones at night. Long-acting painkillers timed so cover does not run out at four in the morning.
These changes cost nothing and frequently resolve the problem entirely.
Check first, though - a few medicines have timing rules for other reasons, such as nitrates needing a nitrate-free period and statins working better in the evening.
See taking a dose late.
Why a sleeping tablet is rarely the answer
Benzodiazepines and Z-drugs work for a couple of weeks, after which tolerance develops.
They increase falls and fractures, impair memory, and cause daytime sedation that adds to whatever else you take.
Withdrawal after regular use causes rebound insomnia worse than the original problem - which is what makes them hard to stop.
They are licensed for short-term use only, and that limit exists for good reasons.
Sedating antihistamines bought over the counter are not a safer alternative - they are strongly anticholinergic and cause confusion and falls in older people.
See temazepam and diphenhydramine.
What works better
Cognitive behavioural therapy for insomnia is the recommended first-line treatment for persistent insomnia, with better long-term outcomes than any medication and benefit that persists after treatment ends. It is available through NHS talking therapies and through digital programmes.
Alongside that: a consistent wake time, reducing caffeine and alcohol, and getting out of bed if you are awake for long periods.
Melatonin is licensed in the UK for short-term use in people over 55 and for some other specific groups. It is not the general-purpose sleep aid it is treated as elsewhere.
See melatonin.
What to do
Note when the sleep problem started relative to any new medicine or dose change.
Bring everything to a review, including over-the-counter sleep aids and supplements.
Ask about timing first, before anything is added.
See medication reviews.
More on side effects and safety in the Side Effects section, including Medicines That Cause Urinary Problems.