Restless legs - can't sleep!

Amanda
I've been struggling with sleep for over a month now. I'm 27 weeks and my restless legs have gotten so bad it keeps me up all night. I've tried everything I can think of: bath, lavender, Epsom salts, muscle rub, elevating legs, elevating upper body. My doc suggested Benadryl and now melatonin. Neither have worked. I've been reading that magnesium could help, I asked my doc and she didn't want me to take any - any ideas why? Is it dangerous? I still have my whole third trimester ahead of me and I'm an emotional mess because I can't fall asleep.