I've had a lot of similar sleep issues (especially the one you describe where the act of walking to bed wakes you up too much to go to sleep) and magnesium does not help me. I've tried drugs, too, and they either don't work or work too well (can't wake up the next day). Benadryl helps, but it worstens my gut motility. I've tried herbs for sleep, but can't take them close enough to bedtime to be helpful (anything in my stomach within 3-6 hours of going to bed refluxes or makes me feel sick once I go to bed - no, acid reducing meds do NOT help this, they make it worse...and I cannot take HCl because it causes intense burning pain in my stomach).
BTW, the jerking on falling asleep is Periodic Limb Movement during Sleep (PLMS). I don't know if any meds can treat this. But I would not be surprised if homeopathy could...homoepathy may also help with your other sleep issues. I've had limited success with some remedies myself (for example, if I consistantly wake up between 3-5am, I take Nux V. before going to bed and it helps me sleep through this time of the morning), but haven't really done any serious trials to find out if my other sleep issues could be resolved this way.
I also think acupuncture could be helpful for you. I cannot do acupuncture because of other issues, but when I was able to do acupuncture it was very helpful for giving me a feeling of overall wellness.
BTW, the whole "sleep hygiene" thing (consistant bedtime & wake time, no TV/computer within an hour of bedtime, etc.) has never helped me any. The biggest thing I've found to help me fall asleep is to read a bit after getting in bed - it somehow helps my brain transition from "awake" to "ready to sleep" more easily. Unfortunately, my Husband has to go to bed so much earlier than I can possibly sleep that I can't read without waking him up... It is a challenging situation.
Have you had dopamine levels tested? Too much dopamine at night can keep you from sleeping... I have one of the genetic variants that causes too much dopamine in the brain. I'm trying to figure out how to balance this but haven't really gotten into it much. I think exercise is one thing that helps with this but I'm unable to right now (too weak/fatigued).
I also wonder if 5HTP could help you. This is a variety of tryptophan, an amino acid necessary for sleep.
I've tried melatonin...it worked great the first couple nights and has never done a thing to help since.
Best of luck,
Chronic Lyme Disease, Bartonella (clinical dx only), Gluten & Sulfite Sensitivity, Many Food/Inhalant/Medication/Chemical Allergies & Intolerances, Asthma, Gut issues (dysmotility, non-specific inflammation), UCTD ("Secondary Lupus-Like Syndrome"), Osteoporosis, chronic Lymphopenia, etc.; G-Tube; Currently on TPN due to bowel problems.
Meds: IV Cipro, Heparin (to flush PICC line), Singulair, Claritin, Domperidone, Colloidal Silver (topically & nasally), probiotics, Milk Thistle, Magnesium, homeopathy.