How many hours will there be in a day 5,000,000,000 years from now?

First off, we should take the wisdom of Jack Wisdom to heart: "Calculation of the history of the lunar orbit is fraught with difficulties." While calculating the history may well be fraught with difficulties, calculating the future is hugely problematic. For the sake of argument, I'll ignore that issue.


The OP suggests the end of the planet is about 5 billion years into the future. The end is much sooner than that. The Sun will be about 10% more luminous then than it is now about a billion years in the future. That should be enough to trigger a moist greenhouse, followed soon by a runaway greenhouse. That moist greenhouse / runaway greenhouse pretty much spells the end of the lunar recession. While some of the tidal dissipation does result from the Earth tides, that is but a tiny contributor to the lunar recession rate. Almost all of the dissipation that leads to the lunar recession results from the ocean tides. Once the oceans vanish, the tidal recession of the Moon will pretty much stop in its tracks.

Assuming the mean lunar recession rate over the next billion years is somewhere between one to four centimeters per year means the Moon will have receded an additional 10,000 km to 40,000 km beyond the current 385,000 km from the center of the Earth in one billion years. The total angular momentum of the Earth-Moon system is $$L_{\text{tot}} = \left(\frac {m_e m_m}{m_e+m_m} R^2 +I_m \right)\Omega + I_e \omega$$ where $m_e$ and $m_m$ are the masses of the Earth and the Moon, $I_m$ and $I_e$ are the moments of inertia of the Earth and Moon about their centers of mass, $R$ is the mean distance between the center of the Earth and the center of the Moon, $\Omega = \sqrt{G(m_e + m_m)/R^3}$ is the Earth-Moon orbit rate, and $\omega$ is the Earth's rotation rate.

Assuming this quantity is conserved, the length of a day in a billion years will be between 25.5 hours (1 cm/year recession rate) and 31.7 hours (4 cm/year recession rate). A recession rate of 2 cm/year will result in a day of 27.3 hours.

The above assumed a constant recession rate. While that is not a good assumption, that range of one to four centimeters per year is probably okay. The lunar recession rate has ranged from over 1.1 to under 3.9 centimeters per year over last several hundred million years. The key culprit in the variations is the shape and orientation of the continents. The current rate of 3.82 centimeters per year is anomalously high thanks to the Americas and Afro-Eurasia, which together create two huge north-south barriers to the tides. This alignment also creates for some marked resonances that increase tidal friction even more than that suggested by the barriers. At other times, the orientation and shape of the continents has impeded the flow of the tides to a much lesser extent.


Once the oceans vanish, it's only the atmosphere and solid Earth tides that can result in the Moon receding from the Earth. The atmosphere will be thicker, which will greatly magnify the atmospheric contribution to tidal recession. However, that contribution is currently extremely tiny. Greatly magnifying a tiny number results in a still tiny number. Moreover, plate tectonics will stop shortly after the oceans disappear. Mountains will disappear. Friction between the atmosphere and the Earth will be much reduced. The other factor, Earth tides, is also very small. That range of a 25.5 to 31.7 hour long day might grow a bit in the four billion years between the end of the oceans and the five billion year figure cited in the question, but not by much.