The withdrawal of Mr Rouhani's ally, Vice-President Eshaq Jahangiri, from Friday's poll had been expected.
On Monday, Tehran's hardline mayor Mohammad Baqer Qalibaf withdrew his candidacy and urged his supporters to back conservative cleric Ebrahim Raisi.
He is now seen as the main threat to Mr Rouhani, who is seeking a second term.
A recent poll had put support for the two hardliners at 52% and for Mr Rouhani at about 42%. Another had Mr Rouhani at 29%, Mr Qalibaf at 12% and Mr Raisi at 11%, with 28% respondents undecided and 20% declining to answer.
If none of the four candidates remaining wins more than 50% of the vote, a run-off will be held on 26 May.
Mr Jahangiri, 60, announced his withdrawal in a speech to several thousand people gathered in the southern city of Shiraz on Tuesday, saying he had run as a candidate to "make the voice of reformists heard".
"I have completed my historic duty and, together with you, I will vote for Rouhani to help continue on the path to progress for this country," he said.
"Vote for Rouhani because he is the man for difficult situations," he added.
Mr Jahangiri played an important role for Mr Rouhani in the heated televised debates held in the weeks running up to the election, during which he defended the president's record and criticised his conservative rivals.
Mr Rouhani has faced a significant challenge from conservatives because the landmark nuclear deal with world powers that he negotiated in 2015 has not triggered the economic recovery he predicted.
Mr Raisi is a close ally of Supreme Leader Ayatollah Ali Khamenei and heads a multi-billion-dollar charitable foundation that manages donations to Iran's holiest shrine in the city of Mashhad.
The former prosecutor has promised to build a self-sufficient "resistance economy", create millions of jobs and triple cash hand-outs to the poor.
A reformist candidate in Iran's presidential election has pulled out to smooth the path for the moderate incumbent, Hassan Rouhani.