It’s rare these days but I have had it happen in the past. Nowadays I’m always so exhausted (from some health conditions) that unless I’ve just had a medication change, I pretty much pass out at bedtime.
Best I can say is if you see yourself starting into a rough night, break the pattern. Don’t lie in bed fretting, get up and do something. Have a snack, read a book, or whatever. I keep an ipod on my nightstand as well - if I’m lying there trying to go to sleep (or have a nighttime bathroom break), I’ll plug it into an ear and start up a podcast - just interesting enough to keep my mind from focussing on stressors, but not totally fascinating (which would itself keep me too alert).
Also, you could ask your doctor for a prescription for a sleeping pill to keep around. Preferably one with a shorter half-life (I was told Sonata is good for that - as in, you could take it at 2 AM and still function at 7 AM). For me, it’s sort of a “security blanket” - I rarely need it, but I know they’re there just in case. Which removes one stressor (“I can’t get to sleep and I can’t do anything about it!!”).