We estimate a model of drug demand and supply that incorporates insurance, advertising, and competition between branded and generic drugs within and across therapeutic classes. We use data on antiulcer drugs from 1991 to 2010. Our simulations show that generics and "me-too" drugs each increased consumer welfare more than $100 million in 2010, holding insurance premiums constant. However, insurance payments in 2010 fell by nearly $1 billion due to generics and rose by over $7 billion due to me-too antiulcer drugs. © 2013 Elsevier B.V.