Painful rectal spasms at night. How to prevent/alleviate this?

Called proctalgia . Fugax or levator spasm. Often severe enough to wake from sleep, more common in women. Getting up and walking around for a few minutes, warm tub soak or even a fleet enema, (sodium bisphosphate) changes the anatomy enough to relieve the spasm. Often disappears as abruptly as it came on. No good treatment except as above.