Your sleep challenges could be the result of certain medications or a combination of medications, you're taking. Many have that effect. Talk to your prescribing doctor about an exit strategy and a real solution for whatever you're currently taking.
You might have some chronic hormonal imbalances or hormonal resistance. This could be from chronic toxicity and inflammation. Until that's resolved, all hormonal functions could remain altered.
The big hormonal players in sleep
In the case of sleep, a number of the large hormonal players are cortisol, melatonin, and insulin, to call just a couple of. In some cases of hormonal imbalance, the results that you simply can't nod off. In other cases, you'll nod off, on the other hand, you awaken often and can't go back to sleep.
By the way, remember that if your cortisol levels are off (or the receptors are congested thanks to toxicity and inflammation) you are going to gain weight and have a tricky time losing it.
Having sensitivities to certain foods can keep you awake at night, too. If you have gut permeability issues (most likely the case if you're sensitive to many foods), this can cause symptoms and discomfort that keeps you restless.
There are solutions...
The good news is that there are solutions that address (and correct) the root cause of inflammation, toxicity, hormonal resistance, and gut permeability issues. Don’t expect to find them via your family doc, however! Typically, you've got to branch out from the basic treatment protocol offered by conventional practitioners and get into more functional diagnostics and care.
Of course, there can be other reasons for the occasional or temporary loss of sleep; things like stressful situations or events, or certain seasons of our lives (like co-sleeping with a baby or young children), or travel, or a major change in life, and so on.
The occasional and temporary loss of sleep isn't so horrible. Humans can be pretty amazing at adapting to stressful environments when we need to. When the sleep deprivation becomes chronic, though, we need to take it seriously and work to correct it just like we would with any other health condition.