strengthen your hamstrings. you probably are imbalanced muscle wise. a good one to do is where you put your back on the ground and your feet on a chair in front of you, bridge and hold.
I had knee pain lingering for about 7 months...I didn't know what was causing it. I was doing rubber guard, but I was flexible enough for it. I checked my form on squatting dead lifting and stretching...all were fine..
I wasn't doing enough hamstrings. To be more exact, None. As soon as I did this exercise I felt immediate (within 10 minutes..) results. continued use of it is only helping.
before my knee pain roughly a 2-4 out of a 1-10 scale.
now it is a 1-2 TOPS, usually a 0...that's after one week.