two words....box squats.
in high school i would free squat almost exclusively, my knees hurt all the time. when i switched to only box squatting in my training, i was able to lean better form, i.e. sitting back, pushing knees out, arching more. and my knees stopped hurting. the combo of sitting back and squatting of the box took away so much stress from the knees.
also you got to make sure your hamstring strength is excellent. i used to have big strong quads, and ver average hamstrings, back when my knees always hurt. then i started focusing more on hamstring deveopment, and that helps tremendously as well. now i have big strong quads, and big strong hamstrings, and virtually no knee pain compared to what it used to be.