The Senate approved the bill by voice vote, sending it to the White House, where President Barack Obama is expected to sign it into law. The legislation also creates a national system for tracking prescription drugs from manufacturers to retail pharmacies, first through serial numbers on bottles and later through electronic codes. The House passed it in September.

More than 750 people were sickened by last year’s outbreak of deadly fungal meningitis and many continue to suffer debilitating pain and nerve damage. The sickness was eventually traced to a now-closed pharmacy in Framingham, Mass., the New England Compounding Center, where inspectors found mold, standing water and other unsterile conditions. The company shipped more than 17,600 doses of the implicated steroid injection to 23 states.

Jurisdiction over such large-volume compounders has been murky. Pharmacies that fill individual prescriptions from a doctor or other health professional are typically regulated by state boards, but the Food and Drug Administration regulates manufacturers of medicines. The compromise bill gives the FDA authority to inspect and close down large-volume compounders, but it doesn’t require the pharmacies to register with the FDA, as manufacturers of prescription drugs must do.

The bill attempts to sort out the legal gray area that allowed the Massachusetts pharmacy and similar businesses to skirt both state and federal regulations. The measure clarifies the FDA’s authority over high-volume compounding pharmacies that mass-produce medications, rather than fill doctors’ prescriptions.

Under the bill, pharmacies can voluntarily register with the FDA and submit to federal quality standards and inspections. FDA officials previously said requiring compounding pharmacies to register with the agency was crucial to preventing future outbreaks.

The bill’s supporters acknowledge that a voluntary approach will succeed only if doctors and hospitals choose to do business with FDA-registered pharmacies.

"Nobody will be required to register in this new category," said Allan Coukell, drug safety expert with the Pew Charitable Trusts, which lobbied to pass the bill. "The success of the voluntary category will depend on hospitals, clinics and doctors choosing to buy from these FDA-registered facilities."

Safety advocates say the bill leaves the door open for more rogue pharmacies like the one that caused last year’s outbreak.

"This voluntary approach will continue to expose patients to potentially unsafe, mass-produced compounded drugs that are not approved or evaluated by the FDA," Rep. Rosa DeLauro, D-Conn., said after the House passed the bill.

FDA officials told Congress last year that regulating businesses like the NECC has been a struggle because of a "patchwork" of conflicting court decisions over the federal agency’s authority to deal with pharmacies.

Traditional compounding pharmacies, generally small operations that fill individual doctors’ prescriptions, will continue to be regulated by state pharmacy boards. Pharmacies that expand into shipping drugs without doctors’ prescriptions can voluntarily register with the FDA as "outsourcing facilities," subject to quality standards and reporting requirements similar to manufacturers.

The FDA will retain the power to shut down any outsourcing pharmacy, registered or not, that does not meet quality standards or engages in illegal compounding, such as mass-producing copies of manufactured drugs.

Experts who helped craft the bill predict that nearly all large compounding pharmacies will register with the FDA as a cost of doing business.

But critics question how the FDA will be able to identify businesses that aren’t following regulations.

Even the compounding industry’s chief lobbying group said the bill will not stop pharmacies like the one that caused last year’s outbreak, and said it could lead to more confusion over pharmacy regulations.

"If the goal of this legislation is to prevent another NECC, which has been stated many times over, then the American public must know that this bill will not accomplish that goal. A voluntary category of outsourcing facilities is not the answer," the International Academy of Compounding Pharmacists said in a statement.

The voluntary approach to regulation was a compromise forged by Republicans and Democrats in the GOP-controlled House. Earlier versions of the bill drafted in the Democratic-controlled Senate would have made registration mandatory.

Despite criticisms of the approach, the bill has garnered broad support, in part because it was bundled together with separate legislation designed to track prescription drugs throughout the U.S. supply chain.

The so-called track and trace system, long sought by doctors and patient groups, is designed to help authorities catch counterfeit or stolen drugs that increasingly have been making their way into the U.S. from overseas.

Drugmakers will be required to add serial numbers to all drug packages within four years. After 10 years the industry must upgrade to electronic codes that can be used to track medicines from the factory to the pharmacy. Drug distributors, packagers and wholesalers will be required to verify the distribution history of the products they ship.