The causes of sore legs in bed are as follows: First, it may be due to muscle strain, such as a lot of sports during the day, which can cause a large accumulation of lactic acid in the thighs or calves. In a quieter state at night, you will often feel the soreness and pain in the calf muscles. Second, it may be caused by calcium deficiency, calcium ions can inhibit the excitability of the neuromuscular junction, when calcium deficiency, the excitability of the neuromuscular junction will increase, often manifested as hand and foot twitching. In adults, it is mostly manifested as spasmodic pain of gastrocnemius muscle at night, that is, calf cramps, which can be manifested as calf pain, or soreness and swelling sensation of calf. Third, also consider vascular diseases, such as lower extremity occlusive vasculitis, lower extremity varicose veins, lower extremity venous thrombosis, which can cause soreness and swelling of the legs at night.