significantly by pain, or anything else, your pain may be a kind of localized fibromyalgia. A Canadian researcher, Moldofsky, established several decades ago that if stage 3/4 sleep (rather than REM sleep) was repeatedly interrupted in volunteers, they would feel tired and achy the next day, as if they had slept on hard ground. REM sleep interruption left volunteers tired, but not achy. The sleep structure of actual fibromyalgia patients suggested that they were not getting stage 3/4 "restorative" sleep to a normal degree.
This is only an oblique contribution to your situation. I think the tissues in or near where you hurt are sending in pain impulses even though there is no normal source of pain. When you move, input from proprioceptors gates off the pain impulses and you don't feel the pain.
Things that might help. Normal movement, to get the pain receptors to shut up. Certain GABA manipulating substances like Neurontin that work on peripheral pain. Certain new sleep meds known to help neuralgia. (I'm not enthusiastic about the latter.) Forty years ago, the pain clinic in our rehab medicine center would have done autonomic nerve chain blocks to help you. But that fashion seems to have died down.
You could also try a TENS unit if someone would prescribe one, or acupuncture (??) or ice packs or yoga or rolfing.... But in the meantime, find out if just being more active might actually help, or at least not make it worse.