Numerous environmental and intrinsic biotic factors have been sought to explain patterns in diversity and turnover. Using taxonomically vetted and sampling-standardized data sets of more than 50,000 taxonomic occurrences in the Paleobiology Database (PaleoDB) we tested whether habitat breadth predicts genus durations and diversity dynamics of marine Mesozoic bivalves, and whether this effect is independent of the well-known positive relationship between geographic range and longevity. We defined the habitat breadth of a genus as a function of its realized ranges in water depth, substrate type, and grain size of the substrate. Our analysis showed that mean values of extinction and origination rates are significantly higher for narrowly adapted genera compared to broadly adapted genera, with differences being evident in all analyzed stratigraphic intervals. Linear models showed that both geographic range and habitat breadth have an independent effect on genus durations and on diversity dynamics. These results reaffirm the role of geographic range and furthermore suggest that habitat breadth is an equally important key predictor of extinction risk and origination probability in Mesozoic marine bivalves. Habitat generalists, regardless of their geographic range, are generally less prone to extinction. Conversely, widely distributed genera that are more specialized may be more endangered than one would expect from their geographic range alone. Extinction rates tend to be higher for specialized genera in both background and mass extinctions, suggesting that wide habitat breadth universally buffers against extinction. The trajectories of origination rates through time differ from those of extinction rates. Whereas there is no pronounced ecological selectivity in origination in the Triassic and most of the Jurassic, Cretaceous origination rates are higher for specialized genera. This may best be explained by diversity-dependence. When diversity levels reach a critical point a further increase in diversity is achieved by elevated origination rates of more specialized forms.