Cause for a bad pain on upper thigh when curled in bed n pain when u start to straighten out leg?

Many reasons. Upper thigh pain can result from holding the leg in a fixed position for a prolonged period. The spasm can also result from dehydration if you exercised a lot and did not keep up with your fluid. A pinched nerve can also do this. Electrolyte imbalances in your system and medications can also be a factor. Slowly stretch the muscles of the leg, try to stand and take a few steps. No resolving? See dr.