Motrin IB). Triptans. Given as pills, shots, or nasal sprays, these medications treat a migraine attack by blocking pain pathways to the brain. They include prescription drugs such as sumatriptan ...