Amirhossein Ghazizadeh Hashemi, 53, dropped his candidacy and urged other candidates to do the same "so that the front of the revolution will be strengthened", the state-run IRNA news agency reported.
Ghazizadeh Hashemi served as one of Raisi's vice presidents and as the head of the Foundation of Martyrs and Veterans Affairs.
He ran in the 2021 presidential election and received some 1 million votes, coming in last place.
Tehran Mayor Alireza Zakani also withdrew on Thursday, as he did previously in the 2021 election in which Raisi was voted into office.
Zakani said he withdrew to "block the formation of a third administration" of former president Hassan Rouhani, a reference to reformist candidate Masoud Pezeshkian.
Pezeshkian is running with the support of former Iranian foreign minister Mohammad Javad Zarif, who under Rouhani negotiated and eventually struck the 2015 nuclear deal with world powers.
The deal later collapsed and Iran has since stepped up enriching uranium to near weapons-grade levels.
Such withdrawals are common in the final hours of an Iranian presidential election — particularly in the last 24 hours before the vote is held, when campaigns enter a mandatory quiet period without rallies.
Voters are set to go to the polls on Friday.
The two withdrawals leave four other candidates still in the race, which analysts broadly see as a three-way contest.
Two hard-liners, former nuclear negotiator Saeed Jalili and parliamentary speaker Mohammad Bagher Qalibaf, are fighting over the same bloc, experts say.
Then there's Pezeshkian, a heart surgeon who has sought to associate himself with Rouhani and other reformist figures like former president Mohammad Khatami and those who led the 2009 Green Movement protest.
Widespread public apathy has descended in the Iranian capital over the election, coming after a May helicopter crash that killed Raisi.