The affinities of three problematic groups of elongate, burrowing reptiles (amphisbaenians, dibamids and snakes) are reassessed through a phylogenetic analysis of all the major groups of squamates, including the important fossil taxa Sineoamphisbaena, mosasauroids and Pachyrhachis; 230 phylogenetically informative osteological characters were evaluated in 22 taxa. Snakes (including Pachyrhachis) are anguimorphs, being related firstly to large marine mosasauroids, and secondly to monitor lizards (varanids). Scincids and cordylids are not related to lacertiforms as previously thought, but to anguimorphs. Amphisbaenians and dibamids are closely related, and Sineoamphisbaena is the sister group to this clade. The amphisbaenian-dibamid-Sineoamphisbaena clade, in turn, is related to gekkotans and xantusiids. When the fossil taxa are ignored, snakes, amphisbaenians and dibamids form an apparently well-corroborated clade nested within anguimorphs. However, nearly all of the characters supporting this arrangement are correlated with head-first burrowing (miniaturization, cranial consolidation, body elongation, limb reduction), and invariably co-occur in other tetrapods with similar habits. These characters are potentially very misleading because of their sheer number and because they largely represent reductions or losses. It takes very drastic downweighting of these linked characters to alter tree topology: if fossils are excluded from the analysis, a (probably spurious) clade consisting of elongate, fossorial taxa almost always results. These results underscore the importance of including all relevant taxa in phylogenetic analyses. Inferring squamate phylogeny depends critically on the inclusion of certain (fossil) taxa with combinations of character states that demonstrate convergent evolution of the elongate, fossorial ecomorph in amphisbaenians and dibamids, and in snakes. In the all-taxon analysis, the position of snakes within anguimorphs is more strongly-corroborated than the association of amphisbaenians and dibamids with gekkotans. When the critical fossil taxa are deleted, snakes ‘attract’ the amphisbaenian-dibamid clade on the basis of a suite of correlated characters. While snakes remain anchored in anguimorphs, the amphisbaenian-dibamid clade moves away from gekkotans to join them. Regardless of the varying positions of the three elongate burrowing taxa, the interrelationships between the remaining limbed squamates (‘lizards’) are constant; thus, the heterodox affinities of scincids, cordylids, and xantusiids identified in this analysis appear to be robust. Finally, the position of Pachyrhachis as a basal snake rather than (as recently suggested) a derived snake is supported on both phylogenetic and evolutionary grounds.