I found reducing stress and cortisol levels helped my insomnia. Instead of intense exercise, I now take a more laid back approach (long walks instead of workouts). I found this site really helpful:
donecountingsheep.com/2018/...
I now eat plenty of carbs and I snack between meals. A big surprise was sugar (which I used to avoid). A very strong cup of chamomile tea (two or three bags in one cup) and a spoon of honey before bed-time made a big difference for me. Instead of suffering two to three nights without sleep, I now get a good seven to eight hours sleep a night. I do not take sleeping tablets (see previous posts) and will NEVER take them again.
Good luck and don't give up trying to give up the medication.