I've had batteries of tests because I would wake with a racing heart (not anxious beforehand, although anxious about it) and also ectopic heartbeats. I suppose the usual basic advice would be to have an echocardiogram if you haven't already and a holter monitor to see what's actually going on with the heart at that time. From your description it sounds like it's a heightened awareness of the heart at that time rather than any dysrhythmia, but only a monitor will say for sure. But you may know all of this.
I personally wish I didn't go on beta blockers as 3 years on them I've put on weight and it happened gradual, and with no change to my eating, so i wasn't prepared for it. That said the beta blockers did their job very well, but I'd have taken a lot less and been a lot more vigilant of my weight and energy levels if I were to do it again.
I wonder if you are getting some vagal stimulation going on as it's happening with a specific posture. Also, how tired are you when you get to bed, have you been pushing yourself? That might account for it. Green tea seems to affect my heart. Also, I'm sensitive to tyramine, so I can't eat cheese, etc, without getting really forceful palpitations. Worth checking for food sensitivity too. Good luck