Tyrant flycatchers constitute a substantial component of the land bird fauna in all South American habitats. Past interpretations of the morphological and ecological evolution in the group have been hampered by the lack of a well-resolved hypothesis of their phylogenetic interrelationships. Here, we present a well-resolved phylogeny based on DNA sequences from three nuclear introns for 128 taxa. Our results confirm much of the overall picture of Tyrannidae relationships, and also identify several novel relationships. The genera Onychorhynchus, Myiobius and Terenotriccus are placed outside Tyrannidae and may be more closely related to Tityridae. Tyrannidae consists of two main lineages. An expanded pipromorphine clade includes flatbills, tody-tyrants and antpipits, and also Phylloscartes and Pogonotriccus. The spadebills, Neopipo and Tachuris are their closest relatives. The remainder of the tyrant flycatchers forms a well-supported clade, subdivided in two large subclades, which differ consistently in foraging behaviour, the perch-gleaning elaeniines and the sallying myiarchines, tyrannines and fluvicolines. A third clade is formed by the genera Myiotriccus, Pyrrhomyias, Hirundinea and three species currently placed in Myiophobus. Ancestral habitat reconstruction and divergence date estimation suggest that early divergence events in Tyrannida took place in a humid forest environment during the Oligocene. Large-scale diversification in open habitats is confined to the clade consisting of the elaeniines, myiarchines, tyrannines and fluvicolines. This radiation correlates in time to the expansion of semi-open and open habitats from the mid-Miocene (c. 15 Mya) onwards. The pipromorphine, elaeniine and myiarchine–tyrannine–fluvicoline clades each employ distinct foraging strategies (upward striking, perch-gleaning and sallying, respectively), but the degree of diversity in morphology and microhabitat exploitation is markedly different between these clades. While the pipromorphines and elaeniines each are remarkably homogenous in morphology and exploit a restricted range of microhabitats, the myiarchine–tyrannine–fluvicoline clade is more diverse in these respects. This greater ecological diversity, especially as manifested in their success in colonizing a wider spectrum of open habitats, appears to be connected to a greater adaptive flexibility of the search-and-sally foraging behaviour.