This New York Times article advises that the first thing to do is to keep your weight within normal range. Extra weight puts stress on knees and can lead to arthritis. Another suggestion is to do squats to strengthen leg muscles. It's important to do the squats correctly and the article links to this video that demonstrates the correct technique. As the adage goes, "An ounce of prevention is worth a pound of cure."