An illustration of several legs in pain.

If your legs hurt, ache, or feel uncomfortable, you may be tempted to chalk it up to aging. But leg pain isn’t inevitable, and often, simple changes can make a big difference.

One common cause of leg pain is statins, drugs used to lower cholesterol. “Ask your doctor—lowering your dose or switching drugs may help,” says Marvin M. Lipman, M.D., professor emeritus of clinical medicine at New York Medical College in Valhalla, N.Y., and former chief medical adviser for Consumer Reports.

Here, the lowdown on several common leg complaints and how to get relief:

Peripheral Artery Disease

Leg pain that starts while you’re walking or climbing stairs could be peripheral artery disease, which affects one in 20 adults older than 50. PAD occurs when arteries outside the heart, most commonly in the leg, become clogged by substances such as fat and cholesterol.

More on Pain Relief

PAD is associated with an elevated risk of heart attack and stroke. Untreated, it can stop circulation in the leg and even lead to amputation.

What to do: Walking can bring on the leg pain of PAD. But prescribed walking—as part of a supervised exercise program designed by your doctor that may be undertaken in a clinic—is actually the best treatment for PAD pain, according to Michael Criqui, M.D., distinguished professor in the division of preventive medicine at the University of California, San Diego, School of Medicine.

Walking and other exercise may help slow the progression of PAD, too. It’s also important to quit smoking and control blood pressure, cholesterol, and diabetes.

Medications for treating PAD, including cilostazol (Pletal and generic) and pentoxifylline (Trental and generic), may only slightly increase your walking distance and can have unpleasant side effects, including diarrhea and vomiting.

Restless Legs Syndrome

An irresistible need to move your legs during inactivity is the key symptom of restless legs syndrome, which affects an estimated 7 to 10 percent of the U.S. population. Symptoms often worsen with age.

What to do: Suzanne Bertisch, M.D., M.P.H., a sleep physician at Beth Israel Deaconess Medical Center in Boston, recommends doing chores at night when you typically have discomfort (RLS symptoms don’t occur while you’re moving), and distracting yourself with activities such as video games or knitting.

Moderate, regular exercise can lessen symptoms, while alcohol, caffeine, and nicotine may trigger them. And talk with your doctor about whether you might have an iron deficiency, which may play a role.

For people whose symptoms aren’t helped by lifestyle changes, medications may be an option, though RLS drugs can have serious side effects. Medications such as pramipexole (Mirapex and generic) can backfire and make the condition worse, while pregabalin (Lyrica) may cause weight gain. Your doctor can help you decide whether drugs might be worth trying.

Nocturnal Leg Cramps

These sudden muscle contractions, which often have no apparent cause, can hurt so much that they wake people from sleep. “They can leave a muscle sore for days,” Lipman says. Up to 60 percent of adults report nocturnal leg cramps.

What to do: First, tell your doctor so that he or she can check for underlying causes such as dehydration, nerve disorders, vascular disease, and calcium, magnesium, and potassium deficiencies.

One of the best fixes is stretching: Keep an old tie on your nightstand, and before bed or when a cramp strikes, wrap it over the ball of your foot. Holding both ends and keeping your leg straight, gently pull the ball of the foot toward your head.

Quinine (an anti-malaria drug) was once used to treat cramps, but the Food and Drug Administration has warned against that practice because of the potential for severe side effects, such as heart problems.

Herniated or Protruding Disc

Pain or numbness that radiates down a leg with tingling, burning, or weakness, and which worsens with movement, could be the result of a herniated or protruding disc in the spine. It’s usually caused by arthritis of the spine, aging, or an injury—or in rare cases, a spinal tumor.

What to do: The pain usually subsides on its own within three months. In the meantime, try alternating the use of ice and heat, or take an over-the-counter pain reliever such as acetaminophen (Tylenol and generic) or an anti-inflammatory drug such as ibuprofen (Advil and generic). Stretching can ease pain and help prevent its recurrence.

If the pain is severe, spinal steroid injections or newer nerve-targeting drugs might help. Or try massage and acupuncture. Consider surgery only if you have severe symptoms or the pain lasts longer than 12 weeks.

A Potential Emergency: Deep Vein Thrombosis

A blood clot in your leg, known as deep vein thrombosis, can feel like sudden pain in a calf or thigh accompanied by swelling, redness, or warmth. It’s usually caused by dehydration, prolonged inactivity, pregnancy, birth control pills, hormone therapy, or certain types of cancer. Clots that break loose can be fatal if they reach your lungs; repeated clots that remain in your legs can cause skin ulcers.

What to do: Call your doctor or go to an emergency room. You’ll need an ultrasound and possibly a blood test and, if the clot may have traveled to your lungs, a chest CT scan. Blood-thinning drugs while you’re in the hospital and for months afterward might be necessary. Prevent clots by exercising regularly and losing excess weight. If you’re on a long trip, get up to stretch your legs every hour or so, or pump your feet back and forth while sitting.

Editor’s Note: A version of this article also appeared in the December 2017 issue of Consumer Reports On Health.