Have you tried Cognitive Behavioral Therapy?
I am a lifelong sufferer of insomnia (though mostly sleep onset) and tried all sorts of increasingly risky things. CBT cured me in ~2 months.