I had knee issues for a long time resulting from hiking and in the past several years a general hip problem. What worked for me was talking with my doctor about it and then being referred for physical therapy. With my knee, I just figured I had a bad knee and was getting older. When I finally did talk to my doctor, I was diagnosed with ITBS, Iliotibial band syndrome. This affects the tracking of the kneecap and the PT worked with me on strategies to resolve it and I have found what works for me to keep it at bay. With my hips, again I discussed with my doctor but the PT was a little more insightful and she noticed that I had a slight imbalance in my right leg length. She gently suggested it might be a little bit of arthritis development in my hip area. The solution was a heel lift in my right shoe which very much helps. Also stretching exercises to loosen muscles. I was also getting some soreness in my back at the time and the PT explained that problems with one can be involved with problems of the other. If you can, mention it to your doctor.

Stretching, PT, yoga, these all help generally to improve flexibility and work some of the muscles that are underused. Too much sitting for instance in an office environment can lead to locking up muscles.