Historical patterns of species diversity inferred from phylogenies typically contradict the direct evidence found in the fossil record. According to the fossil record, species frequently go extinct, and many clades experience periods of dramatic diversity loss. However, most analyses of molecular phylogenies fail to identify any periods of declining diversity, and they typically infer low levels of extinction. This striking inconsistency between phylogenies and fossils limits our understanding of macroevolution, and it undermines our confidence in phylogenetic inference. Here, we show that realistic extinction rates and diversity trajectories can be inferred from molecular phylogenies. To make this inference, we derive an analytic expression for the likelihood of a phylogeny that accommodates scenarios of declining diversity, time-variable rates, and incomplete sampling; we show that this likelihood expression reliably detects periods of diversity loss using simulation. We then study the cetaceans (whales, dolphins, and porpoises), a group for which standard phylogenetic inferences are strikingly inconsistent with fossil data. When the cetacean phylogeny is considered as a whole, recently radiating clades, such as the Balaneopteridae, Delphinidae, Phocoenidae, and Ziphiidae, mask the signal of extinctions. However, when isolating these groups, we infer diversity dynamics that are consistent with the fossil record. These results reconcile molecular phylogenies with fossil data, and they suggest that most extant cetaceans arose from four recent radiations, with a few additional species arising from clades that have been in decline over the last ~10 Myr.