The first-line treatment for chronic insomnia in clinical guidelines isn't a drug — it's CBT-I (cognitive behavioral therapy for insomnia), and it beats sleeping pills over the long run. Its core moves are counterintuitive. Stimulus control: only use the bed for sleep, and if you're awake more than ~20 minutes, get up — this stops your brain from learning that bed means lying awake frustrated. Sleep restriction: temporarily limit time in bed to build sleep pressure and consolidate fragmented sleep, then expand. Consistent wake time, even after a bad night, anchors the circadian clock.
The baseline habits matter too: morning daylight exposure to set the clock, no caffeine within about 8–10 hours of bed (its half-life is ~5 hours, so an afternoon coffee is still working at midnight), a cool dark room, and alcohol avoided — it knocks you out but suppresses REM and fragments the second half of the night, which is why you wake unrefreshed after drinking.