Yes, you need to take the calcium and magnesium together, the same capsule at the same time.
I was thinking about your post throughout the day. Have you tried cranio sacral therapy, thats amazing to help your body sort itself and could really help you with sleeping.
Also, do you go swimming or do some other low impact cardio exercise, that might help in the short term.
I think you need to find the cause of the problem, but just thinking out loud really as solutions to the symptoms if you like.
I do think cranio sacral therapy would be a massive help though.

Much love and best of luck.