I agree with Birdy, that 4am panic is cortisol flooding your body, right at the very time you're generally supposed to head in to the deepest sleep of the night - it's horrible 😞😞
It's your adrenals firing off, because they're trying to make you produce oestrogen, which is at its highest level (during fertile years) in the morning. During peri/meno, your adrenal cortex kicks in to produce ‘old lady oestrogen' (as I call it) which leads to panic, anxiety and hot flushes. As your body and receptors in your brain adapt to work with this type of oestrogen, you will get these uncomfortable symptoms less and less - at least, that's the theory....
But that doesn't help you when you're being literally smashed awake 😞😞. My worst surges used to happen from about 2am, so I have Xanax next to my bed to use if that should happen, as I need to be up at 5 for work. It's very short acting, puts me back to sleep within 20 minutes, wears off with me within 2 hours, so I am fine to get up and ready for work. I only take .5mg which is much less than the 1 - 2mg the gp recommended I take when this hell first hit me. I'm bleeding every two weeks these days so I might need to take it for 1 or 2 nights a fortnight.
I also take a very small dose of mirtazapine at night before bed which has helped my sleep no end.
My heart really goes out to you, it's debilitating at times and so manifestly unfair that some of us suffer so dreadfully. I hope you're feeling better now xx