The non-negotiables
Fixed wake-time every day. Bed is for sleep and sex only — no scrolling. If you cannot sleep within ~20 minutes, get up, do something boring in dim light, and return when sleepy. Limit caffeine after noon. Get bright light early in the day.
What matters less than people think
Exact bedtime, magnesium supplements, white-noise machines, blue-light glasses, and 8 hours as a universal rule. Individual sleep need ranges from 7 to 9 hours for most adults; chase quality and regularity, not a number.
When it is more than habits
If insomnia persists more than 3 nights/week for 3 months, ask about CBT-I (cognitive behavioural therapy for insomnia) — recommended first-line by the American College of Physicians, AASM and NICE, before sleeping pills.