There are a couple of reasons why the temperature of your water heater could increase by itself. The most obvious problem is a bad thermostat. The heat sensor in the thermostat is supposed to keep the water from heating beyond the set temperature. If the heat sensor fails, the temperature of the water will continue to increase until the backup thermostat causes the heating element to turn off. Unless you are knowledgeable about water heater repair, you should call a professional to determine which thermostat is not working. The thermostat of an electric water heater typically carries 240 volts, so it should only be removed and replaced by someone familiar with electrical safety.
The problem could also be mean that the tube surrounding the heating element is damaged. This means that the element is heating the water directly. When this happens, you may still get hot water until the element burns out. You may even continue to get some hot water as the second element continues to heat the water. A professional can test both the upper and lower heating element with an ohm meter to determine if they are functioning within acceptable levels. This should only be done by someone familiar with electrical safety and after the power leads are disconnected.
If you have had your water heater for more than 10 years, it may be more cost effective to install a new unit. The time, labor, and cost of repair will often equal the price of a new unit. A new energy-efficient model will also help you save money on utility bills.