As a Chiropractor, when someone tells me that they are having trouble sleeping because of leg pain, my first instinct is NOT to try to cover up the symptoms with a pill, but rather to try to figure out the root cause of the problem.
At the very least, your question suggests that you might have a calcium and magnesium deficiency. From the Chiropractic perspective, you might have a low back and hip problem which is blocking the flow of blood and nerve information to your leg; this can be resolved through re-alignment and stretching. At the most, your symptoms suggest a circulatory disorder that should be dealt with before it becomes something more serious.
Get your circulation checked, get your spine checked, and maybe even join a gym and have a personal trainer give you a program which will balance your body and loosen up your muscles.