I had insomnia for about 10 years and it nearly killed me.
I finally realized that whenever I had any gluten at all, even a micro dose, it would pop my eyes awake in the middle of the night, reliably. I think it's really weird. I always thought, yeah yeah cut back on gluten dairy etc. and try to eat healthy. But that's not what's going on. I can eat unhealthfully but as long as I don't get ANY gluten, I sleep like a baby. I don't know why it took me so long to figure it out, Maybe it was that I was sleep deprived. Also it seems like whey in whey protein shakes sometimes hurts my sleep and I've given that up as well. But gluten does seem to be the big culprit.