Evidence that platynotan squamates (living varanoid lizards, snakes and their fossil relatives) are monophyletic is presented. Evolutionary relationships within this group are then ascertained through a cladistic analysis of 144 osteological characters. Mosasauroids (aigialosaurs and mosasaurs), a group of large marine lizards, are identified as the nearest relatives of snakes, thus resolving the long-standing problem of snake affinities. The mosasauroid–snake clade (Pythonomorpha) is corroborated by 40 derived characters, including recumbent replacement teeth, thecodonty, four or fewer premaxillary teeth, supratemporal–prootic contact, free mandibular tips, crista circumfenestralis, straight vertical splenio-angular joint, loss of posterior ramus of the coronoid, reduced basipterygoid processes, reduced interpterygoid vacuity, zygosphene–zygantral articulations, and absence of epiphyses on the axial skeleton and skull. After mosasauroids, the next closest relatives of snakes are varanids (Varanus, Saniwa and Saniwides) and lanthanotids (Lanthanotus and Cherminotus). Derived features uniting varanids and lanthanotids include nine cervical vertebrae and three or fewer pairs of sternal ribs. The varanid–lanthanotid–pythonomorph clade, here termed Thecoglossa, is supported by features such as the anteriorly positioned basal tubera, and the loss of the second epibranchial. Successive outgroups to thecoglossans are Telmasaurus, an unresolved polytomy (Estesia, Gobidermatidae and Helodermatidae), Paravaranus and Proplatynota. The ‘necrosaurs’ are demonstrated to be an artificial (polyphyletic) assemblage of primitive platynotans that are not particularly closely related to each other. Snakes are presumed to have evolved from small, limbless, burrowing lizards and the inability of previous analyses to resolve the affinities of snakes has been attributed to extensive convergence among the numerous lineages of such lizards. The present study contradicts this claim, demonstrating that the problem is due instead to omission of critical fossil taxa. No modern phylogenetic analysis of squamate relationships has simultaneously included both mosasauroids and snakes: previous studies have therefore failed to identify the mosasauroid–snake association and the suite of derived characters supporting it. Mosasauroids are large aquatic animals with well-developed appendages, and none of the derived characters uniting mosasauroids and snakes is obviously correlated with miniaturization, limb reduction or fossoriality. Recognition that mosasauroids, followed by varanids and lanthanotids, are the nearest relatives of snakes will also facilitate studies of relationships within snakes, which until now have been hampered by uncertainty over the most appropriate (closely–related) lizard outgroups.