Snakes have numerous features distinctive from other tetrapods and a rich history of genome evolution that is still obscure. Here, we report the genome of the five-pacer viper, Deinagkistrodon acutus, and comparative analyses with species from other major snake and lizard lineages. We map the evolutionary trajectories of transposable elements (TEs), developmental genes and sex chromosomes onto the snake phylogeny. TEs exhibit dynamic lineage-specific expansion; in the viper, many TEs may have been rewired into the regulatory network of brain genes. We detect signatures of adaptive evolution in olfactory, venom and thermal-sensing genes, and also functional degeneration of genes associated with vision and hearing. Many Hox and Tbx limb-patterning genes show evidence of relaxed selective constraints, and their phylogenetic distribution supports fossil evidence for a successive loss of forelimbs then hindlimbs during snake evolution. Finally, we infer that the Z and W sex chromosomes had undergone at least three recombination suppression events in the ancestor of advanced snakes, with the W chromosomes showing a gradient of degeneration from basal to advanced snakes. These results forge a framework for our deep understanding into snakes' history of molecular evolution.