You basically need to strengthen your stabilizing muscles on the inside of the knee and keep the outside of the ITB nice and loose.
The pain also comes a lot from the hips. So stretching well through the hips, piriformis, buttocks, and hamstrings helps with keeping the knee and the knee joint in place.
I'm big on Stairmaster, elliptical, and swimming. These activities stretch through your stomach and keep your spine nice and straight and build your lower abs.