Based on my own experience and all that I have read, I believe that the vast majority of sleep disorders occur due to an underlying psychiatric condition. I have GAD, which used to wake me up every night after 4-5 hours of sleep. I couldn't rest and properly recover and I couldn't lead the active lifestyle I love. The only thing that gave me sleep was Xanax, which can't be your go-to option because of addiction that comes with regular use. So I went to see a GP and she prescribed my Trazodone but to no avail. At that point, she referred me to psychiatrist and that's when things drastically changed. I was prescribed Escitalopram (an SSRI) for treating underlying anxiety disorder and Chlorprothixene (an anti-psychotic) as an auxiliary drug exclusively for sleep. After 3-4 weeks of SSRI treatment, the effect started kicking in. I don't have the middle of the night awakenings anymore. I don't always take Chlorprothixene. The overall anxiety background went away and my mood stabilized. That's when I realized that I actually had a depression for years apart from GAD (because now I can compare my state before and after). TL;DR – I strongly suggest that people see a psychiatrist first if insomnia shows up. Take care and sleep well!