The relationships among the genera of fungus gnats in the mycetophilid subfamily Leiinae are unclear, and the monophyly of this group is questionable. This monograph provides an extensive phylogenetic study of the Leiinae based on morphological data from a large taxonomic sample, including all genera that have ever been assigned to the subfamily and a wide outgroup sampling to properly test subfamilial monophyly. A data matrix with 128 morphological features of 117 terminal taxa was carried out under parsimony using different implicit weight schemes. All recovered topologies support a monophyletic Leiinae that is more restricted than the usual delimitation of the subfamily. We found no consistent evidence that a clade with Docosia Winnertz, Novakia Strobl, Ectrepesthoneura Enderlein, and Tetragoneura Winnertz group together with the remaining genera of Leiinae. A name with subfamily rank – Tetragoneurinae, already present in the literature – is used here to refer to this group. The allactoneurine genera Sticholeia Søli and Allactoneura de Meijere form a clade with the leiine genus Leiella and the genera of Manotinae, which is deeply nested within the Leiinae. The male terminalia patterns found within the subfamily are analyzed and illustrated. A classification for the Leiinae is proposed grouping 33 genera in seven clades ranked as tribes: Selkirkiini Enderlein, Megophthalmidiini, trib. nov., Rondaniellini, trib. nov., Cycloneurini Shaw and Shaw, Manotini Edwards, Anomalomyiini, trib. nov., and Leiini Edwards. A key for the world genera of Leiinae is also provided. The Cretaceous mycetophilid fossil record is revisited and the biogeographic evolution of the Leiinae is discussed.