An enlarged sternum with a prominent keel is a central feature of the flight apparatus of modern birds. However, sterna of near-bird dinosaurs (Pennaraptora) and early avialans are either substantially different from those of living birds or absent altogether, raising questions about how specialized sternal structures evolved in birds and how they are related to function. This remains poorly understood because of the fragmentary nature of the fossil record, and the challenges in inferring form and function from crushed fossils. We use ancestral character estimations to trace sternal trait acquisition through the bird stem group, and multivariate phylogenetic regressions to analyse relationships between sternum morphology, body mass and flight capabilities. We find that sternum evolution was episodic: basal members of Pennaraptora had proportionally small sterna, which became larger and more craniocaudally elongated in Avialae. This enlargement precedes the appearance of a midline ridge, a possible precursor of the sternal keel, in Pygostylia. Sternum size increased again in crownward Ornithuromorpha, alongside a fully formed sternal keel and enlarged caudal projections, both critical areas of flight muscle attachment. Sternal experimentation in relation to flight characteristics occurs several times throughout Pennaraptora, including within Paraves and Enantiornithes, indicating that powered flight may have evolved several times before proliferating in crown-group birds.