Stretching when pregnant

I can’t stop with the urge to stretch every night when I turn on to my back and it’s driving me insane as it wakes me up every time. It’s my legs, tummy and back that want to stretch but I’m worried this will hurt the baby as I’ve seen mixed things about stretches.

Sometimes it’s like a spasm.

Has this happened to anyone else? How do I stop it or is it ok?