The transition from land to water in whales and dolphins (cetaceans) was accompanied by remarkable anatomical, physiological and behavioral adaptations. To better understand the genomic changes that occurred during this transition, we systematically screened for protein-coding genes that were inactivated in the ancestral cetacean lineage. We discovered genes whose loss is likely beneficial for cetaceans by reducing the risk of thrombus formation during diving (F12, KLKB1), improving the fidelity of oxidative DNA damage repair (POLM), and protecting from oxidative stress-induced lung inflammation (MAP3K19). Additional gene losses may reflect other diving-related adaptations, such as enhanced vasoconstriction during the diving response (mediated by SLC6A18) and altered pulmonary surfactant composition (SEC14L3), while loss of SLC4A9 relates to a reduced need for saliva in aquatic environments. Finally, the complete loss of melatonin synthesis and receptor genes (AANAT, ASMT, MTNR1A/B) may have been a precondition for the evolution of unihemispheric sleep. Our findings suggest that some genes lost in the ancestral cetacean lineage may have been involved in adapting to a fully-aquatic lifestyle.