Mylan NV agreed to pay $465 million to settle allegations that it overcharged the government for its EpiPen products, the latest move by the embattled pharmaceuticals firm to quell the furor over its pricing practices.

The settlement with the U.S. Department of Justice comes after senators and federal health officials recently alleged Mylan had wrongly classified EpiPen as a generic product, when it should have been considered a brand product. The penlike injector delivers an emergency shot of epinephrine to counter severe...