I've suffered from knee pain while riding also. For me the answer was the pedals. I went from minimum float pedals (Looks) to high-float pedals (Speedplays). Immediate relief. Maybe checkout the amount of float in your pedals and increase it if you have minimum float pedals. Maybe just try regular flat pedals at first to see if that helps.