We study the gains from trade in a model with oligopolistic competition, heterogeneous firms and innovation. Our key finding is that a trade-induced increase in market concentration can be an important source of the gains from trade. Foreign competition puts downward pressure on profitability which reduces the equilibrium number of firms, but increases their size. This rise in concentration increases welfare via two channels: increasing returns in production, and a scale effect on innovation. In a calibrated version of the model we show that concentration is a main driver of the gains from trade, mostly via its stimulating effect on innovation – the contribution of increasing returns is small. Moreover, lowering trade costs reduce the inefficiency produced by “reciprocal dumping”, leading to substantial gains. In contrast, the associated reduction in markup dispersion has only a negligible effect.