What usually causes a water heater to have to be replaced is corrosion of the tank. It eventually starts to leak. Most other problems can be corrected by adjustment or replacement of a component such as the thermostat. How frequently do you flush the sediment from the heater? As mentioned above, if you have not done this maintenance task recently and you have relatively hard water, you may want to flush it and see if a significant amount of sediment is removed.