Cell competition-the sensing and elimination of less fit 'loser' cells by neighbouring 'winner' cells-was first described in Drosophila. Although cell competition has been proposed as a selection mechanism to optimize tissue and organ development, its evolutionary generality remains unclear. Here, by using live imaging, lineage tracing, single-cell transcriptomics and genetics, we identify two cell competition mechanisms that sequentially shape and maintain the architecture of stratified tissue during skin development in mice. In the single-layered epithelium of the early embryonic epidermis, winner progenitors kill and subsequently clear neighbouring loser cells by engulfment. Later, as the tissue begins to stratify, the basal layer instead expels losers through upward flux of differentiating progeny. This cell competition switch is physiologically relevant: when it is perturbed, so too is barrier formation. Our findings show that cell competition is a selective force that optimizes vertebrate tissue function, and illuminate how a tissue dynamically adjusts cell competition strategies to preserve fitness as its architectural complexity increases during morphogenesis.