Doctors don't look into vitamin deficiencies quite enough. I had an ongoing problem with my legs aching, not RLS, just incredible aching. I am miserable during the change of seasons, especially. I'd been to a few specialists, but one particular reumatologist tested me for Magnesium and said I was deficient. She recommended that I take Magnesium, but didn't tell me how much. The magnesium amount that I started with was 250 mg. I found out through some research of my own, that I need to take about 750 to 800 mg per day. That's for 150 pounds. If you are a higher or lower weight, you need to adjust accordingly. Make sure that you include any other supplements that you take. Some supplements have magnesium in them, but only 35 to 50 mg. or less.
I had a bout of TMJ syndrome recently. I had stopped taking the magnesium. Now, that I'm back on it, the muscle has relaxed considerably and I am not clenching quite as much.
Magnesium deficiency can cause a multitude of issues. It's definitely worth looking into.