Marine reptiles flourished in the Mesozoic oceans, filling ecological roles today dominated by crocodylians, large fish, sharks and cetaceans. Many groups of these reptiles coexisted for over 50 million years (Myr), through major environmental changes. However, little is known about how the structure of their ecosystems or their ecologies changed over millions of years. We use the most common marine reptile fossils—teeth—to establish a quantitative system that assigns species to dietary guilds and then track the evolution of these guilds over the roughly 18-million-year history of a single seaway, the Jurassic Sub-Boreal Seaway of the United Kingdom. Groups did not significantly overlap in guild space, indicating that dietary niche partitioning enabled many species to live together. Although a highly diverse fauna was present throughout the history of the seaway, fish and squid eaters with piercing teeth declined over time while hard-object and large-prey specialists diversified, in concert with rising sea levels. High niche partitioning and spatial variation in dietary ecology related to sea depth also characterize modern marine tetrapod faunas, indicating a conserved ecological structure of the world’s oceans that has persisted for over 150 Myr.