Some years ago I used to have a knee that clicked when doing a deep knee bend. Around that time, I began playing tennis regularly, 2 or three times a week. Eventually, the clicking went away. My conclusion was that exercise, particularly lateral movement, strengthened the structure around the knee. It was still necessary to pay attention to what I was doing though. Playing on hard courts caused discomfort but playing on clay courts was fine. Riding the bike, my knee seems to be to be fine also but I need to be sure it is tracking straight up and down. Early on in my cycling I found the right knee had a tendency to flop to the inside just about grazing the top tube. I corrected that with an insert in the shoe and all is well again.