The problem with diagnosing knee pain is there are multiple possible causes. The original cause may not even be in the knee itself! I have a cyclist friend whose knee seized up. He went to a physiotherapist, who explained that the real problem was an extremely tight lower back. The tightening back was tugging at his gluteal muscle (buttock), which in turn was tightening his hamstring - which was pulling his knee out of alignment! His body was actually acting against itself, as each muscle struggled to retain its preferred position. The physio pummelled out his back and glutes, he did back stretches for a few weeks, and everything relaxed.
I've had ITBS for almost a year, caused by a combination of incorrect seat height and an over-aggressive cycling schedule. The iliotibial band is a tendon-like bit of muscle which runs down the outside of the thigh and connects the hip and knee. When it tightens, it pulls at your knee-joint and rubs painfully against the bone, becoming inflamed.
For this problem, stretching has been surprisingly effective. I stretch the IT band itself, my hamstrings, and my lower back and glutes. The stretches I do are:
IT band - Standing stretch. Stand upright and cross one foot behind the other. Then lean towards the foot that is behind the other. Hold this stretch for about 15 to 20 seconds, and then repeat it 3 to 4 times on each leg.
Hamstring - Standing stretch. Basically, try and touch your toes, although I do this with legs crossed one behind the other. With this one, if you let your upper body just hang loose, you will feel the stretch increase naturally after a few seconds.
Glutes/lower back - Seated twist. This is an effective stretch for the big muscles in your buttocks.
Glutes/lower back - Supine spinal twist. Great for the lower back, and your hips.
Obviously, these exercises may or may not be helpful for you, depending on the exact cause of your problem. Only a doctor will be able to correctly diagnose your issue. But they're easy to do, safe, free, and may be helpful.