Viviparity has putatively evolved 115 times in squamates (lizards and snakes), out of only ~ 140 origins in vertebrates, and is apparently related to colder climates and other factors such as body size. Viviparity apparently evolves from oviparity via egg-retention, and such taxa may thus still have the machinery to produce thick-shelled eggs. Parity mode is also associated with variable diversification rates in some groups. We reconstruct ancestral parity modes accounting for state-dependent diversification in a large-scale phylogenetic analysis, and find strong support for an early origin of viviparity at the base of Squamata, and a complex pattern of subsequent transitions. Viviparous lineages have higher rates of speciation and extinction, and greater species turnover through time. Viviparity is associated with lower environmental and body temperatures in lizards and amphisbaenians, but not female mass. These results suggest that parity mode is a labile trait that shifts frequently in response to ecological conditions.