Warm weather, high altitudes or absent-mindedness can lead to overproofed dough, with overworked yeast stretching the flour’s structure to an unstable puffiness. If you’ve caught the dough in time, the yeast may still have some life left for a remedial rising.
If this is the first rise, punch down the dough and let it rise again.
Continue with the shaping, second rise and baking as usual.
If the dough has overproofed after being shaped, then punch it down, reknead and reshape.
Before baking, let the dough rise again for a shorter amount of time than the recipe specifies. The dough will not rise as high this time, and the final texture will be affected: The crumbs will be finer, and the bread will be denser but should taste fine.
Don’t bake bread that has overproofed after being shaped; its weakened structure will collapse in the oven.
Follow your own recipe for rising times; they vary widely depending on the type of bread or cake.