Back pain at night

Sy

For a few years now I’ll be asleep and be woken up with my back really tight. It’s a spasm and it will feel like someone is squeezing all around my ribs and mid back. It happens every few months and I’m not doing anything different those times but the spasm will last for several hours during the night. Has anyone had this? I’m not sure what to do it’s so random but so painful.