The drug maker Teva Pharmaceutical Industries said on Monday that it had agreed to pay $512 million to settle claims that a subsidiary, Cephalon, paid generic manufacturers to keep their own cheaper versions of a drug off the market, a practice that the Supreme Court ruled in 2013 could be illegal in some cases.

The lawsuit was brought by drug wholesalers and other companies that buy drugs directly from manufacturers, who argued they were forced to pay inflated prices for Provigil, a medicine that helps people with narcolepsy and other sleep disorders stay awake.

The settlement, which must be approved by a judge, is the largest in the history of such cases ever paid to direct purchasers of drugs, lawyers for the plaintiffs said in a motion filed Friday with Judge Mitchell S. Goldberg of the United States District Court’s Eastern District of Pennsylvania.

“That’s a great result for consumers,” said David A. Balto, an antitrust lawyer and a former Federal Trade Commission policy director. “This was an agreement that was a pretty naked effort to take generic drugs off the market.”