Unfortunately there is no getting away from the fact that we sit too much these days. It is also no secret that prolonged sitting can be one of the number one causes of upper and lower back pain but it can also be a major factor in causing hip pain.
Continual sitting causes your hip muscles to contract, being held in a persistant contracted position will, over time, make the joint feel stiff on movement as range of motion will be lost as the muscles become tighter and tighter. This problem is only compounded by age, as we get older, our muscles tighten up even more. If you remember back when you were a child sitting with your legs crossed in front of you on the floor was something that you were able to do for hours on end. How long has it been since you were able to sit like this? Or bend effortlessly? Or do a squat without feeling creaky?
Unfortunately hip pain is a complex issue and has various forms of causes. You can experience hip pain when resting, moving, or when standing for very different reasons. If hip pain is persistent, you should see a doctor for a diagnosis as you may have arthritis and may be in need of a hip replacement especially if the pain is stopping your from sleeping.
If too much sitting and bad posture are responsible for your hip pain regular stretching and mobilizing exercises will help release tension and stiffness by relaxing your pelvis muscles.