My daughter went through the same symptoms, starting at age 3 and a half. It was tefrrifying the amount of pain she was in in her knees and also hips. We went to countless doctors and specialists.
Eventually a physiotherapist diagnosed extreme hypermobility, she was fitted for orthotics insoles which she had to wear in her shoes, all day every day, which restricted the excessive mobility in her ankles knees and hip joints.
We were told what to avoid, excessive exercise in a short period of time, gymnastics, yoga type movements, restrict trampolining to a few minutes.
Never to pull on her joints or swing her by her arms or legs no roughousing from other kids.
Also we were told that 30 mins exercise for her is equivalent to 5x that of another child so to always allow for that, and ensure early bedtimes.Much more sleep is necessary to compensate for the huge strain on the body.
She is now almost 10, the improvement following the orthotics was huge over the first few months, she still has them,( updated every 6 months for growing,) There have been ups and downs, at growth spurts she hurts, cold viruses can attack her joints and cause pain at night BUT the improvement has been steady and consistent, now she plays regular suitable sports on teams and is coping well at school. In Reception she was in so much pain she only managed 4 mornings a week for the whole year!
The orthotics are expensive but totally necessary, we couldn't get them on the NHS.
We have been told she will eventually grow out of the problems by about 30 as she naturally gets stiffer with age.
It was incredibly difficult to find out what was wrong and we were told repeatedly 'growing pains' However the physio and the 2 podiatrists we have seen, all said they see hundreds of children with varying degrees of Hypermobility which if left unchecked caused all sorts of issues as the grow up, long term bad backs, neck problems etc.
I suggest go to a good paedeatric physio and get your ds tested.
Good Luck