What can I do to keep my muscles from getting too painful?

Heat . Moist heat and keep hydrated with an appropriate electrolyte balanced drink.
Muscle Pain. Regular exercise at reasonable intensities should help you condition your muscles so that you do not feel unnecessary pain. If your pain continues consult with an exercise physiologist. My best.
Depends... Why are your muscles in pain ? Your md can determine the cause and help solve your problem.Is your exercise routine at fault ?
Do not over use them. Do not misuse them , avoid trauma and injury . Under normal circumstance in the absence of muscular , neurologic or endocrinological or toxic metabolic disturbances , you should not have painful muscle . If you spontaneously develop muscle pain , please see your pcp. Good luck.
Endurance/strength. Unless you have a neuromuscular disease, strength and endurance training will allow you to function without pain. Muscle tightness can be improved with ice/heat and gentle stretching. See a physiatrist to diagnose the cause of your pain and to give you an individualized treatment plan.
Yoga. Try yoga, gentle stretching, deep breathing, warm bath, meditation, regular exercise, massage and acupuncture. All these treatments can help reduce pain.