Major ecological transitions are thought to fuel diversification, but whether they are contingent on the evolution of certain traits called key innovations1 is unclear. Key innovations are routinely invoked to explain how lineages rapidly exploit new ecological opportunities.1,2,3 However, investigations of key innovations often focus on single traits rather than considering trait combinations that collectively produce effects of interest.4 Here, we investigate the evolution of synergistic trait interactions in anglerfishes, which include one of the most species-rich vertebrate clades in the bathypelagic, or "midnight," zone of the deep sea: Ceratioidea.5 Ceratioids are the only vertebrates that possess sexual parasitism, wherein males temporarily attach or permanently fuse to females to mate.6,7 We show that the rapid transition of ancestrally benthic anglerfishes into pelagic habitats occurred during a period of major global warming 50-35 million years ago.8,9 This transition coincided with the origins of sexual parasitism, which is thought to increase the probability of successful reproduction once a mate is found in the midnight zone, Earth's largest habitat.5,6,7 Our reconstruction of the evolutionary history of anglerfishes and the loss of immune genes support that permanently fusing clades have convergently degenerated their adaptive immunity. We find that degenerate adaptive immune genes and sexual body size dimorphism, both variably present in anglerfishes outside the ceratioid radiation, likely promoted their transition into the bathypelagic zone. These results show how traits from separate physiological, morphological, and reproductive systems can interact synergistically to drive major transitions and subsequent diversification in novel environments.