regularly stretch and roll out focus on quads, hips, and IT band since all the muscles connect to ur knee, maybe even look into PT if it’s really bad. this happened to me and i took a break and did PT to strengthen and now im better and stronger than before even a few years later. i still stretch often but also when i do leg extensions i do a light 20 second hold w 10-30 pounds both legs then a 10 second hold single leg which has really helped especially for squats i think
My knee instability came from my knee being in the wrong spot (used to be knock kneed) and structural problems with my gait (leaned to heavily on the outsides of my feet), so a combo of these exercises and kinesiology tape to correct the knee position helped rectify this. Please be careful though, as we may have completely different issues and I don’t want you blowing ur knee out. Stay safe!