You poor thing. I can totally empathise.

I had insomnia in both of my pregnancies during the last trimester, waking at a similar time as you and unable to get back to sleep for hours. I discovered Phenergan the second time around. It is given to treat morning sickness, but a side effect of it is drowsiness. I researched it and there is no evidence of harm to the baby or danger to the pregnancy (one would hope not, either, if docs are using it to treat MS!! I just wanted to make sure for peace of mind). It worked wonders for me - I took 1/2 a 25 mg tablet before bed most nights towards the end if the pregnancy, and slept wonderfully. It's available over the counter. Another option safe for pregnancy is Benedryl, although I'm not sure about taking it long term and didn't research it in depth; unlikely that there would be much info on long term use in pregnancy anyway.

Long term sleep deprivation like that is awful, especially when you're awake for hours. Both times the sleep deprivation from having a newborn has been a walk in the park compared to the pregnancy insomina. I don't think think I could have continued working without the Phenergan second time around. HTH