What type of water heater do you have? If electric, one of the two heating elements is burned out or a bad thermostat.
Only one element is on at one time. With a cold tank the upper element is turned on to heat the upper half of the tank. When it reaches the set temperature, the upper thermostat switches power to the lower element. The lower element heats the water until its thermostat is satisfied.
With a normal operation as cold water enters at the bottom of the tank, the water cools from the bottom as the hot water is drawn from the top. When the upper half of the tank get colds enough, the upper thermostat switches power away from the lower and switches it to the upper heating element.