I had insomnia for years. I sleep pretty good now with occasional bad night of sleep like anyone else. I can list a few things that helped me.
Bed is for sleeping and sex only. Don't eat or read or do anything else in bed. This will program your mind once you lay down that it is time to shutdown.
Install a blue light filter on your computer and/or tablet or other devices. I use f.lux which is free.
https://justgetflux.com/Meditate before bed for 10 mins or so.
Don't ingest any caffeine past noon. Or avoid caffeine all together.
Breathright strips
Get a really nice comfortable pillow. This helped me immediately.
If you wake up in the middle of the night get up and read or something until your tired again. Sometimes just a midnight snack can help you get back to sleep.
Remember that even if you are not sleeping well. You are still resting. Try and enjoy just laying there if you can. Good time to meditate and not follow thoughts.
Good luck with all that. There is no magic cure. Some things work for some and not others. I tried all sorts of things over the years and these helped me the most.
"In the universe there is an immeasurable, indescribable force which shamans call intent, and absolutely everything that exists in the entire cosmos is attached to intent by a connecting link." ~Carlos Castaneda