"Everyone should vote in this important election".
Rouhani is still seen as the front-runner, but he faces a tougher than expected challenge from Raisi, who has rallied religious traditionalists and working-class voters disillusioned with the stagnant economy.
Oscar-winning director Asghar Farhadi, a vocal Rouhani supporter, cast his vote at a polling station in Cannes, France where he was attending the film festival.
"Instead of using the capable hands of our young people to resolve problems, they are putting our economy in the hands of foreigners", Raisi said at a closing campaign rally in second city Mashhad on Wednesday.
"We must all respect the vote of the people", Raisi said as he cast his ballot in southern Tehran. I like his detente policy with the world.
Ahmad Majidyar, who leads the IranObserved Project at the Middle East Institute, believes that "many reformists are dismayed by the President's unwillingness to stand up to the country's judiciary and security establishment", meaning many may simply not bother to vote at all.
Early in his tenure, Rouhani shared a 2013 phone call with then-U.S. President Barack Obama, the highest-level exchange between the two countries since Iran's 1979 Islamic Revolution and the U.S. Embassy hostage crisis.
One of the most unsafe regimes on the planet - the Islamic Republic of Iran - will hold presidential elections today.
"But it is a risky decision". But Iranians in both political camps suspect he is in fact backing his protege Raisi - not only for the presidency but potentially also as a possible successor to his own post of supreme leader, which the 77-year-old hardline cleric has held since 1989. Although the supreme leader did not single out any candidate, it was easy to read it as aimed at Rouhani.
But in an apparent reference to the 2009 disturbances, Khamenei, an unelected clerical hardliner who has the ultimate say in Iran, has previously warned he would confront anyone trying to interfere in the election. He is the standard-bearer for hardliners disappointed by Mr Rouhani's nuclear deal with America and other world powers, which has yet to produce a much-promised economic revival.
Still, many appear willing to give his policies time to bear fruit, and hope Rouhani can lift the remaining United States sanctions that are stifling trade.
In Iran, where political speech is severely curtailed, newspapers and even social media channels are government regulated and protest comes with great personal risk, the quadrennial presidential election is an opportunity to blow off emotional steam, to act politically in the most public, and loud, of ways. But this time the outcome might be much closer, as other conservative rivals have backed out and thrown their support behind Raisi.
Analysts have rejected Raisi's promises of jobs and cash handouts as unrealistic but admit these could win traction with voters who have felt few benefits so far from the nuclear deal.
Two other conservative candidates are still officially in the race.
But analysts agreed the gathering of Khamenei's powerful allies behind Raisi seemed to have the unintended effect of energising Rouhani's supporters, uniting opposition and pro-reform figures, artists and activists to back his re-election. Raisi accused Rouhani of "economic elitism, mismanagement, yielding to Western pressure, and corruption". But since the Iranian government counts anyone who works just one hour a week as employed, according to Hamed Mousavi of Tehran University, the true overall number is likely well over 20%.
While the vote may not have a decisive influence on foreign policy, which is set by Khamenei, the election of a hardliner could harm Iran's global image and further deter foreign trade and investment seen as vital to rebuilding the economy.
Voting was extended by at least five hours to 11 p.m. (1830 GMT) because many people were still waiting in line, state television reported. Iran's Guardian Council, a 12-member panel half selected by the supreme leader and half nominated by the judiciary and approved by parliament, vetted the candidates and narrowed the field to six, including Rouhani.