Our hot water runs out during one not-too-long shower. By the end of the shower, I have the cold water completely off and the hot water coming out is only lukewarm. My husband already replaced both heating elements and both thermostats. What else could be causing this?
The most likely reason is a degraded/broken dip tube in the hot water heater. If this were the case, there would likely be little bits of plastic in your water, which perhaps could be seen if you removed a faucet aerator. To replace the dip tube, the cold water inlet must be removed, and the new tube installed. One related cause is if the inlet and outlet of the water heater are swapped. If swapped, the cold water in the bottom of the tank is supplied to fixtures.
Another reason is an unintentional mixing of the hot water and cold water. It's possible that there is a broken faucet somewhere that allows the water to mix, providing lukewarm water.
I suggest also verifying that the hot water is reaching the proper temperature. If you drain a little bit of water from the tank, is it the proper temperature? If not perhaps the wiring is wrong, the thermostat is broken, or the thermostat is set to the wrong temperature.