It is unclear what effect the laws about prescription painkillers are having on death rates, which in some ways are the ultimate measure for any public policy aimed at reducing substance abuse. Some experts argue that measures to reduce prescribing painkillers may be having the unintended consequence of driving people to try heroin and other illicit drugs. Others dispute that, pointing out that the shift toward heroin use happened before the recent policy focus on opioids took hold.

The use of opioids began to skyrocket in the 1990s in the face of claims by pharmaceutical companies and medical experts that opioids could be used to treat conditions like back pain and arthritis without fear of addicting patients. But as their misuse and abuse became rampant, public health officials, doctors, regulators and pain-treatment advocates remained deadlocked for years over how to address the public health crisis, arguing over whether tighter prescribing rules would penalize patients who needed the medications.

Some patient and medical groups maintain that little scientific data exists to warrant major new restrictions. But such arguments appear to be losing sway.

Along with the threat of addiction, there is also growing evidence that when given to patients in high doses, opioids pose a greater risk of overdoses as well as problems such as sleep apnea, sharply reduced hormone production and increased sensitivity to pain.

“We have a much better sense of the risks,” said Dr. Bruce Psaty, a researcher at the University of Washington in Seattle, who studies drug safety. “The culture has begun to change.”

Sales of opioids reached an estimated $1.98 billion in 2014, according to IMS Health, a research firm that collects prescribing data. There is little question that the drugs help tens of thousands of patients function better, including those suffering from chronic or long-lasting pain.

The moves now underway in Massachusetts and other states are not the first attempts to control how drugs are prescribed. Every state, with the exception of Missouri, now has a so-called prescription monitoring program to try to stop people from getting prescriptions from multiple doctors.