Thank you for your email. Joint pains in the ankles and knees are fairly common, but they shouldn’t usually cause someone to wake up from their sleep.
For really really painful joints (that medications prove ineffective for), it's important to exclude inflammatory causes of pain, such as rheumatoid arthritis and infective arthritis.
I would strongly suggest that you consult an Orthopaedic Surgeon, who would thoroughly examine the affected joints. Some blood and radiological investigations may also be done. Once the cause is found, appropriate treatment can be instituted to treat the problem.
Hope this helps
Dr Sean Ng