Can you place a small pillow under your knees for sleeping? This may help.
Check your covers, if they are too tight they will hold your legs and feet in odd position during sleep.
Check your pants make sure that the leg has enough give when you walk, move around or sit. It can go unnoticed, and cause knee strain that will baffle you.
See if you have to pull the leg of the pants up to have better range of motion and then you will be aware.
Check your shoes, specifically the heel inside and out. Make sure there is cushion left to 'cushion' your heel and leg.
Have you jumped or done something out of the ordinary? Have you stomped your foot to make a point? Sometimes these things go unnoticed and yet are perfomrd with more morce than is realized causing temporary discomfort.
I would say to try mixing some cayenne pepper with any beneficial oil or ointment or cream and rub on the knee - then wrap with something warm maybe the tube of an old sock and keep warm while sleeping.
Take apple cider vinegar, and drink lots of water.
These things may help, and are very easy to try. If the discomfort continues - then it may be necessary to go down the rest of the list: back alignment, arthritis etc.
I have found that most often when my knee hurts it turns out to be one of the first things I listed, and sometimes even for back pain, it turns out to be an ill fitting pair of pants or shoes...
Hope you figure this out...