I had knee pain for a long time until I did a few things that made a great difference. Stretching minimally before the ride; much more after. Seat height adjustment, then speedplay pedals with more float. These three things worked for me. I tried them in that order. I would say that my knee pain progressively diminished as I moved through these steps, but the pedals made the greatest diffence for me. But, every "body" is different. I would begin with stretches, then a pro bike fit. Go from there 'til you find the relief you're looking for. Good luck!
Urbanmonk