When you experience a rapid loss of hot water, the problem is probably the dip tube. This tube is really a pipe that is is attached to the cold water inlet pipe (inside the water heater) and transports the cold water through the hot water to the bottom of the water heater where the burner can heat it up. It is designed to prevent the cold water from coming into the top of the water heater and running right over to the hot water outlet and out to the faucets. All water that is brought in through the cold pipes ends up on the bottom of the water heater and the hot water stays on the top. Once in a while the dip tube falls off inside the hot water heater and the cold water doesn't go to the bottom but stays on the top, so you get cold water out of the hot water faucet after only a few minutes. In order to stop your loss of hot water, you will need to pull the cold water inlet pipe and verify the condition of the dip tube.