Marine ecosystems have expanded into the infaunal realm below the surface of soft sediments throughout the Phanerozoic eon. During the Palaeozoic era, this expansion largely involved sedentary animals living in permanent resting places. Active sand‐burrowing animals colonized the infaunal environment later, but when this happened and when specialization for infaunal life evolved remain open questions. Here, phylogenetic evidence, fossil occurrences and previously established criteria for recognizing the sand‐burrowing habit in marine gastropods are used to determine how many gastropod clades became infaunal and when the transitions from surface‐dwelling to infaunal life occurred. At least 20, and as many as 35, clades (all but one of post‐Palaeozoic age) contain actively infaunal species. The overwhelming majority (15 of 20 clades) became infaunal during the Cenozoic, and clades with hundreds of infaunal species in the living fauna diversified beginning in the Early Miocene. The repeated evolution of, and specialization to, the sand‐burrowing habit by gastropods and other animals was enabled by increased habitat availability and higher marine productivity, and was necessitated by intensifying predation. As a result, the infaunal realm was transformed from a marine refuge to an integrated part of the marine biosphere in which high performance in locomotion and defence has become the norm.