You might want to see a doctor, before it possibly gets worse.
It sounds like crepitus.
Mine used to click when I bent them. No longer. Now they just lock and straightening them out is a painful process. See a doctor before yours get any worse.
It is due to lack of calcium and oil to your knee It is best to take ayurvedic treatment for curing from knee problem.