Eshaq Jahangiri, 60, a reformist and moderate, dropped out of the election, leaving just four candidates remaining in the race, according to state-run IRNA news agency.
Voicing his full support for the 68-year-old president, he vowed to do everything in his power so that Rouhani could secure a victory in the upcoming election.
Rouhani, a pragmatist cleric, was elected in 2013 by 51 per cent of votes on promises to ease Iran's global isolation and end the house arrest of opposition leaders.
Iranians will go to the polls Friday, the same day Donald Trump begins his first foreign trip as U.S. President arriving in Saudi Arabia, where the kingdom's leaders vowed this month to start "the battle against Iran".
Mr Raisi, is now the head of the powerful Imam Reza shrine and charitable foundation in the holy city of Mashhad and, in addition to attracting support from traditional conservatives, is seen as the favoured candidate of the security establishment.
To win, the candidate must score more than 50 percent of the vote. It is likely others will drop out to solidify support for other candidates, especially as one of them is serving as vice president in Rouhani's government. Qalibaf pulled in 4 million votes in the first round of balloting in 2005 and over 6 million in 2013.
"I will vote for Mr Rouhani in the presidential election", Jahangiri said as he announced he was withdrawing his candidacy.
In the wake of Qalibaf's withdrawal, Aniseh Bassiri Tabrizi, a research fellow at the Royal United Services Institute in London, told Bloomberg that it's not a given that most Qalibaf supporters will automatically switch to Raisi.
The former prosecutor is now head of a multi-billion-dollar charitable foundation that manages donations to Iran's holiest shrine in the city of Mashhad.