Knee pain much worse sitting or in bed at night--behind the knee?

Likely tendonitis. Pain that is worse at rest and at night may be tendonitis. The hamstring tendons attach behind the knee and if inflamed may be the cause of your pain. Stretching and anti-inflammatories are a good place to start.
Arthritis. You may have arthritis, or a tear of the meniscus which has allowed a cyst to form behind the knee. Would recommend an evaluation.