Hello! Having a cake collapse in the middle after looking wonderful in the oven is a very common frustration, but it usually comes down to just a few specific factors related to structure and temperature. Here is a breakdown of what might have happened and how you can prevent it next time.
First, the most frequent culprit is underbaking. Even if the cake appears golden and nicely puffed on top, the center is the last part to cook through. If the internal structure of starches and proteins has not fully set, the trapped steam will cool down and condense once you take the cake out of the oven, causing the unsupported middle to fall. To check for doneness, always insert a toothpick or wooden skewer into the exact center; it should come out clean or with a few moist crumbs, but without wet batter.
Second, using too much leavening agent, such as baking powder or baking soda, can cause this issue. Excess leavener produces too much gas too quickly. The cake expands rapidly before the flour and egg proteins have had adequate heat and time to form a stable matrix, and that excessive height inevitably collapses under its own weight. It helps to ensure you are leveling off your measuring spoons carefully.
Third, opening the oven door too early during the baking cycle can introduce a sudden rush of cool air and physical vibration. This can deflate the fragile air pockets before they have solidified. As a general rule, try to keep the oven door closed until at least three-quarters of the baking time has passed.
Lastly, your oven might be running hotter than the dial indicates. If an oven is too hot, the outside of the cake sets and browns rapidly, tricking you into thinking it is finished while the middle remains unbaked and heavy. An inexpensive oven thermometer placed on your center rack can help you verify your actual baking temperature.
I hope this explanation helps you troubleshoot your next bake! Please feel free to share the exact recipe if you would like more specific guidance.