In brief:
Can be several

The hip and knee receive their nerve supply from the same nerve, the obturator so that a knee problem can present as knee &/or hip pain & vice versa.

Usually, pain in the joints after lying down is usually a sign of arthritis as motion keeps the joint fluid bathing the joint surfaces which is how the cartilage gets its nutrition.

In brief:
Can be several

The hip and knee receive their nerve supply from the same nerve, the obturator so that a knee problem can present as knee &/or hip pain & vice versa.

Usually, pain in the joints after lying down is usually a sign of arthritis as motion keeps the joint fluid bathing the joint surfaces which is how the cartilage gets its nutrition.
Would you like to video or text chat with me?

In brief:
Hip/Knee pain

There can be several causes of hip and knee pain ranging from:
1) injury or disease localized to the hip or knee joint and/or
2) referred pain.

The back can refer pain to the hip and knee region. The hip can refer pain to the knee region.
Therefore see your doctor for a through history and physical examnination and possible imaging evaluation to elucidate the source of your pain.

In brief:
Hip/Knee pain

There can be several causes of hip and knee pain ranging from:
1) injury or disease localized to the hip or knee joint and/or
2) referred pain.

The back can refer pain to the hip and knee region. The hip can refer pain to the knee region.
Therefore see your doctor for a through history and physical examnination and possible imaging evaluation to elucidate the source of your pain.
Would you like to video or text chat with me?