Prescription opioid sales by volume dropped by 13 percent in Pennsylvania and 15 percent in New Jersey last year, outpacing a national trend.

Nationally, distribution of the painkilling medications declined 11 percent in 2017, compared with the previous year, according to a new report by Avalere, a Washington health analytics firm.

As physicians heeded campaigns to do more for their patients' pain, prescription opioid use grew steadily through the 1990s and early 2000s, peaking in 2011. Though still well above rates from the 1990s, use has been declining in recent years, as states and health groups look to stem a national opioid epidemic that, many say, started with prescriptions and has moved on to illicit drugs such as heroin and fentanyl.

"States' efforts to tackle the opioid crisis have been ongoing for several years with various levels of success," Kelly Brantley, vice president at Avalere, said in a statement. "Limiting the supply of opioids, such as through fill limits, is gaining traction as part of a broader set of strategies being tested by states as they continue to confront the opioid crisis."

The Avalere report looked at how fill limits correlated with the amount of prescription opioids sold. Prescription opioid distribution declined in all but one state — Idaho — with the greatest declines in states that limit how much doctors can prescribe.

Pennsylvania and New Jersey are among 22 states that have enacted legislation to limit opioid prescribing in response to a national opioid epidemic.

As of January 2017, doctors in Pennsylvania cannot prescribe minors more than a seven-day supply of opioid painkillers, with some exceptions, such as for cancer and palliative-care patients. To refill the prescription, doctors would need to first determine whether the minor had a mental-health or substance-abuse disorder, and discuss the risks with a parent or guardian.

People who receive an opioid painkiller prescription in a hospital emergency department are also limited to a seven-day supply, under Pennsylvania guidelines.

Doctors must also check the state's prescription opioid database to see whether patients are already being prescribed opioids by another doctor.

New Jersey passed legislation last year to limit initial prescriptions to a five-day supply for most patients. Doctors can extend the prescription to 30 days, if necessary.

According to the Avalere report, prescription opioid sales declined the most in Maine, by 24 percent.

"There's been a lot of attention at the national level, so we're helping states understand how they're doing, what things work and what doesn't," said Clara Soh, a director at Avalere. "We're looking at correlation here, and it does look like the states that are being proactive are seeing greater changes."

The report is based on analysis of opioid data from the U.S. Drug Enforcement Agency, which tracks the distribution of controlled substances. The report excluded buprenorphine and methadone, opioids that are used primarily used to treat opioid use disorder.

While the decline in the number of prescription opioids sold is promising, addiction remains a major health crisis.

More than 1,200 people died of a drug overdose in Philadelphia last year — the highest drug death rate of any major U.S. city.

Fill limits can help, but must be part of a broader solution to make sure people get the pain medications they need without over prescribing, while improving access to treatment for addiction, Soh said.

"It's not just fill limits, or clinical guidelines," she said. "There's no one magic bullet."