James E. Gilbert, MD
You may also have physical stress-induced degradation of the cartilage of the knee, which caused a small chunk of cartilage to break off and this chunk can then become lodged in between bones in the knee (much like the plica) and cause a sharp pain and even difficulty moving.
Third cause could be a muscle around the knee that is either spasming or is strained by your sleeping position. This would explain the prolonged discomfort and difficulty you have with moving the knee the next day.
Hope this helps!