Pain, usually caused by a strong or disruptive stimulus, is an unpleasant sensation that serves as a warning to organisms. To adapt to extreme environments, some terrestrial animals have evolved to be inherently insensitive to pain. Cetaceans are known as supposedly indifferent to pain from soft tissue injury representatives of marine mammals. However, the molecular mechanisms that explain how cetaceans are adapted to pain in response to seawater environment remain unclear. Here, we performed a molecular evolutionary analysis of pain-related genes in selected representatives of cetaceans. gene was identified to be pseudogenized in all odontocetes (toothed whales) except from (sperm whales), and relaxed selection of this gene was detected in toothed whales with pseudogenized . In addition, positive selection was detected in pain perception (i.e., , , , and ) and analgesia (i.e., , , , and ) genes among the examined cetaceans. In this study, potential convergent amino acid substitutions within predicted proteins were found among the examined cetaceans and other terrestrial mammals, inhabiting extreme environments (e.g., V441I of TRPV1 in cetaceans and naked mole rats). Moreover, specific amino acid substitutions within predicted sequences of several proteins were found in the studied representatives of cetaceans (e.g., F56L and D163A of ASIC3, E88G of GRK2, and F159L of OPRD1). Most of the substitutions were located within important functional domains of proteins, affecting their protein functions. The above evidence suggests that cetaceans might have undergone adaptive molecular evolution in pain-related genes through different evolutionary patterns to adapt to pain, resulting in greater sensitivity to pain and more effective analgesia. This study could have implications for diagnosis and treatment of human pain.