What position do you sleep in?
If you sleep on your front, that could be the reason.
If you sleep on your back with your legs very straight, that could also be the reason.
If you do sleep on your back, try putting a thick cushion under your knees to keep your knees bent.
If you sleep on your side, try putting a pillow between your knees to raise the top leg slightly and to stop it pulling down on your pelvis.
Try that for a few nights, and if no joy, I recommend you see a registered Chiropractor, who will be able to examine you thoroughly and diagnose the problem.