Sinking can happen due to overmixing the batter or opening the oven door too early. To prevent this, mix the batter until just combined and avoid opening the oven door for the first 20-25 minutes of baking.