Cetaceans (whales, dolphins, and porpoises) are a group of specialized mammals that evolved from terrestrial ancestors and are fully adapted to aquatic habitats. Taking advantage of the recently sequenced finless porpoise genome, we conducted comparative analyses of the genomes of seven cetaceans and related terrestrial species to provide insight into the molecular bases of adaptation of these aquatic mammals. Changes in gene sequences were identified in main lineages of cetaceans, offering an evolutionary picture of cetacean genomes that reveal new pathways that could be associated with adaptation to aquatic lifestyle. We profiled bone microanatomical structures across 28 mammals, including representatives of cetaceans, pinnipeds, and sirenians. Subsequent phylogenetic comparative analyses revealed genes (including leptin, insulin-like growth factor 1, and collagen type I alpha 2 chain) with the root-to-tip substitution rate significantly correlated with bone compactness, implicating these genes could be involved in bone mass control. Overall, this study described adjustments of the genomes of cetaceans according to lifestyle, phylogeny, and bone mass.