For MOST people, with no unusual problems, things that help are:
-avoid strenuous rides, such as hills, rough trails, riding fast for long distances
-stay in really easy gears, so the legs are spinning rapidly, but against very slight resistance
-stay off the bike a day or two if the knees are hurting BEFORE the ride
I was able to ride three or four days a week with sore knees using these methods. As the muscles above and below the knee got stronger, the problems gradually went away.
Most younger folks that I see riding use really tough gears. Boys, especially, take macho pride in riding on the BIG ring. That little ring is there for a reason.
It sounds like it would be a good idea to have a doctor monitor the knee. The symptoms that can be cured by a couple days of rest are very similar to injuries that can end up getting serious.