The most widely accepted theory is that pterosaurs went extinct due to the same event that wiped out the dinosaurs. This was likely a massive asteroid impact around 65 million years ago, leading to a global climate change and mass extinction event known as the Cretaceous-Paleogene (K-Pg) extinction.
Pro tip: Pterosaurs were not dinosaurs; they are part of a separate group of flying reptiles. Their extinction is linked to the same event but through different mechanisms compared to non-avian dinosaurs.