Most of the time pain the knee is caused by weakness of the hips and\or the glutes. Weakness of the gluteus medius can cause tibial external rotation when flexing the knee and this can cause pain either immediately or in the long run.

In the following video a therapist describes this and shows how to treat this type of pain:

Before going on with how to self treat this type of problem, we have to understand what tibial external rotation is and why it causes knee pain.

Tibial external rotation syndrome is a condition in which the tibia rotates externally on the femur instead of maintaining a neutral position. Over time this can lead to medial knee pain as the supporting structures are strained and can cause meniscus tearing and ligament damage. This is not limited to medial knee pain, in my case, as a matter of fact, lateral and anterior knee pain were also present.

One of the test to see if this might be your case is doing a lounge forward. From watching the entire leg during the lunge forward movement you may notice the foot following the knee and collapsing into pronation. You have to know that it is the hip that controls the knee and foot.

Being an athlete and not a doctor what I always focus on to solve a problem are muscles: usually either I have to strengthen some muscle or lengthen another, sometimes both.

So I focused my research on what muscles contribute to the internal rotation of the tibia: sartorious, gracillis and semitendinosus. These three converge to make up the pes anserine to prevent tibial rotation.

More than 10 years ago I had surgery on the knee to repair a torn ACL and as a graft they used exactly the gracilis and the semitendinosus tendons so I think that this problem that I have now is correlated to that (after surgery it is not uncommon for the tendons to never grow back). This also explains why I have very little to no pain when I do sumo squats: the gracilis is fully pulled and so it can better rotate the tibia.

Now that we have identified the problem, here we have some info on how to self treat:

But the most useful self-treatment I learned was from this video: