An oversensitive trigeminal nerve—the cranial nerve responsible for facial sensation and jaw movement—may be partly to blame for what causes migraines. Experts think that migraine sufferers may be genetically predisposed to the condition. Migraines can be set off by certain foods, strong perfumes, flickering lights, hormones, or weather changes. They may cause a chemical release that swells blood vessels and sends out pain signals.

Migraines can cause you to become hypersensitive to sound and light, and can last from a few hours to three days. They can also be accompanied by nausea and blurred vision or flashing lights known as auras. Women are up to three times more likely than men to suffer from these high-powered headaches.

Treat It First With

Try an over-the-counter pain reliever, such as ibuprofen, naproxen, or a combination of acetaminophen, aspirin, and caffeine (Excedrin Migraine and multiple generics have all three) if the migraine is mild. Those remedies block the release of prostaglandins, which send pain signals to the brain. Take the meds promptly: Studies suggest that digestion may slow down during a migraine, making it difficult to metabolize drugs. A hot or cold compress on your head or face could also help to relieve the pain. And if you haven’t taken medicine that includes caffeine, try an 8-ounce cup of coffee, which should help to constrict blood vessels. There’s one surprising way to relieve migraine pain: having sex. A 2013 German study in the journal Cephalalgia found that among 800 migraine sufferers, two-thirds who had sex during their migraine reported that headache pain was lessened afterward.

If That Doesn’t Work

See your doctor ASAP to get a prescription med called a triptan. Consumer Reports Best Buy Drugs recommends sumatriptan (Imitrex and generic) as a good migraine treatment option. These drugs constrict blood vessels in the brain. They can ratchet down pain within 2 hours and help relieve nausea.

Get to an Emergency Room

If pain is severe or you have nausea or you’re vomiting, you may need an injection of a triptan, which can work right away, or an IV of a different drug, such as ketorolac (Toradol). You may also need an antiemetic to help stop vomiting.

Never Do This

Don’t take more pain reliever than the amount prescribed or indicated on the label. Doing so can also lead to rebound headaches. And don’t take opioids, such as hydrocodone (Vicodin) or oxycodone (OxyContin, Percocet) as a migraine treatment. They’re rarely effective for migraine pain.

Prevent It in the First Place

Figure out your triggers and avoid them. Alcohol, stress, dehydration, and aspartame (found in chewing gum and diet soda) can be problems. For some, not getting their usual amount of caffeine can also trigger a migraine. Stress is often the culprit for those who suffer from chronic migraines (occurring on more than 15 days per month). To reduce your stress, try biofeedback or cognitive behavioral therapy. Acupuncture could also help.

Chronic migraine sufferers should also consider a daily dose of certain high blood pressure drugs shown to reduce migraine frequency, including propranolol (Inderal and generic) and timolol. The antiseizure drugs topiramate (Topamax and generic) and valproic acid (Depakote and generic), and certain antidepressants such as amitriptyline (generic only) can also help as a migraine treatment.

Editor's Note: This article and related materials are made possible by a grant from the state Attorney General Consumer and Prescriber Education Grant Program, which is funded by the multistate settlement of consumer-fraud claims regarding the marketing of the prescription drug Neurontin (gabapentin).

This article also appeared in the June 2016 issue of Consumer Reports magazine.