here are some tips on how to prevent them Drink plenty of water throughout the day. Doctors recommend six to eight glasses everyday. Massage your muscles before going to bed. Stretch daily, before and after exercise. Maintain a well-balanced diet and eat foods high in calcium (such as milk and cheese), potassium (bananas and dates), and Vitamin E (spinach and sweet potatoes). if these cramps are a constant problem then you really need to see a doctor.