You should first figure out what causes the water heater to get excessively hot. Then, fix those issues to bring your water heater back to normal condition.  Generally, a non-functioning thermostat, shorted heating element, and setting the thermostat too high are some common reasons behind an overheating water heater.  Luckily, I mentioned every troubleshooting step you should take to fix the issue. So, follow the steps I recommended.