The key lies in exercising muscles surrounding the knee joints - the quadriceps (front thigh muscle), the hamstrings (back thigh muscles), the abductors (outside thigh muscles) and the adductor (inside thigh muscles). Exercising the muscles around your knee will keep them strong and less susceptible to injury. Exercising often, will also help keep your joints from stiffening, providing you with needed support, making movement easier and therefore reducing pain.
The following, simple exercises will both help you stretch and strengthen the knee area.
Straight-Leg Raise (Lying)
Here's How: Bend one leg at the knee, keeping the other leg straight. Lift the foot just off the floor and hold it for a slow count of 5, then lower. Repeat 5 times with each leg. For effective results, repeat this exercise in the morning and at night. You may also do so in bed.
Here's How: Start at the bottom step of a staircase. Lift your left foot up on the above stair. Bring it back by your right foot. Then lower your right foot, bringing it back to neutral. Repeat, this time raising your right foot to the above stair, back to neutral, then lowering you left foot. Hold onto the banister if necessary and continue to repeat this exercise until you tire.
Here's How: Hold onto a chair. Squat down until your kneecap covers your big toe. Return to standing. When you are first starting, complete 10 repetitions. Then, as you improve, try to squat a little further, just be sure not to bend your knees beyond a right angle.
Here's How: Sit on the edge of your bed. Cross your ankles over and push your legs upwards, until your thigh muscles feel tense. Hold for 10 seconds, then relax. Switch your legs and repeat. Do 4 sets with each leg.
Here's How: Sit on the floor, with your legs stretched out in front of you. Slowly bend one knee, until you feel a comfortable stretch. Hold for 5 seconds. Then straighten you leg as much as you can and hold for another 5 seconds. Repeat this exercise 10 times for each leg.
Straight-Leg Raise (Sitting)
Here's How: Sit comfortably in a chair. Be aware of your posture. Straighten and raise one leg. Hold for a slow count to 10, then slowly lower your leg. Repeat 10 times with each leg. If over time you find this easy, try the exercise with light weights on your ankles, toes pointing towards you. Do this exercise every time you sit down.
Here's How: Sit on a chair. Without using your hands for support, stand up, then sit back down. Ensure that each movement is slow and controlled. Repeat this exercise for a total of 1 minute. Over time, as you feel more comfortable, try to increase the number of sit/stands in 1 minute and try the exercise from a lower chair, or the bottom steps of a staircase.