If you find yourself with a microwave fire, FIRST, use a fire extinguisher. If you don't have one, try to throw lots of baking soda or salt on it. Never use flour, which can explode or make the fire worse. Lastly, Smother the fire with a wet towel or other large wet cloth.
Pro tip: Buy a fire extinguisher.