I've suffered from insomnia on and off since adolescence. For me, what works is meeting particular needs every night (or as close to it as possible):
- Go to bed at the same time every night (and get up at the same time every morning) - This is essential. After a couple months of following this pattern you will start to feel tired at the time you normally go to bed, and will start waking up before your alarm clock.
- If you can't get to sleep after an hour or two, don't sweat it . . . get up, read a book, take a crap, whatever. DON'T fall into the trap of sleeping in and fucking up your schedule, you're going to have a tired day the next day. By sticking to the schedule though, you have a better chance of getting good sleep the next night.
- Cool, quiet, completely dark room. Get some blackout blinds, make sure that you're not being woken up by weird sounds (a white noise type generator can help with this if the noise is beyond your control), make sure that you aren't overheating (this is a really big one with me - interestingly enough I've found that sleeping without a pillow keeps me much more comfortably cool at night - YMMV).
- No screen time (of any kind) within an hour of bed (try something else that's relaxing . . . have a shower or a bath, do a little reading, whatever helps you calm down)
- No hard exercise within an hour of bed (I used to come home from Jiu-Jitsu practice and it would take me two or more hours to relax because I was so keyed up)
- Regular, daily exercise. If you spend all morning sitting, all afternoon sitting, and all night sitting . . . is it any wonder that your body doesn't feel tired? The nice ache that you get from exercise helps sleep happen.
- No caffeine of any kind after 1:00 pm.
- No liquids of any kind within two hours of bed (sucks to wake up to pee).
- No phones in the room that you sleep.
Things that suck for insomnia:
- Booze makes it easy to get to sleep, but tends to give you a shitty /non-restful sleep
- Memory foam beds are very comfy . . . but I've found that I sink into them and tend to overheat much more quickly than if sleeping on a typical firm mattress or even the floor.
- Partners. Yeah, they're awesome in the day (and evening), but sometimes they can snore, hog the covers, toss/turn, and generally make your evening miserable. Have a second place set up in your home where you can leave the room and sleep if they're interrupting your sleep.
- Sleeping pills. They're almost all addictive, and none of them will work long term. In fact, once you've developed a tolerance for them you'll find that it's even harder to get to sleep.
Insomnia gets worse the longer it goes on . . . it's like your body gets stuck in a rut that prevents normal sleep. By the same token though, once you're on a sleep schedule that works it helps keep you sleeping properly.