Quality regulation attempts to ensure quality and to foster price competition by reducing vertical differentiation, but may also have unintended consequences through its effects on market structure. We study these effects in the context of pharmaceutical bioequivalence, which is the primary quality standard for generic drugs. Exploiting the staggered phase-in of bioequivalence requirements in Chile, we show that stronger quality regulation decreased the number of drugs in the market by 25%, increased average paid prices by 10%, decreased total sales by 20%, and did not have a significant effect on observed outcomes related to drug quality. These adverse effects were concentrated among small markets. Our results suggest that the intended effects of quality regulation on price competition through increased (perceived) quality of generics were overturned by adverse competitive effects arising from the costs of complying with the regulation. To investigate the scope for improving policy implementation, we estimate a structural model with endogenous entry and certification allowing us to simulate the effects of alternative policy designs.