Official figures give him 51% of the five million ballots counted so far – well ahead of second-placed Mohammad Baqer Qalibaf the Tehran mayor on 17%.
If Mr Rouhani maintains that margin, he will be able to avoid a run-off vote.
Electoral officials said turnout was high among the 50 million Iranians eligible to vote on Friday for a successor to Mahmoud Ahmadinejad.
His eight years in power have been characterised by economic turmoil and Western sanctions against Iran over its nuclear programme.
The interior ministry began releasing preliminary figures early on Saturday after a delay of several hours.
Voting was extended until 23:00 local time (18:30 GMT) on Friday to allow more people to cast their ballots. Iranian Press TV reported that turnout was 80%.
It is unclear when the final results will be known.
Although all six candidates are seen as conservatives, analysts say Mr Rouhani – a 64-year-old cleric often described as “moderate” who has held several parliamentary posts and served as chief nuclear negotiator – has been reaching out to reformists in recent days.
The surge of support for him came after Mohammad Reza Aref, the only reformist candidate in the race, announced on Tuesday that he was withdrawing on the advice of pro-reform ex-President Mohammad Khatami.
Mr Rouhani therefore went into polling day with the endorsement of two ex-presidents – Mr Khatami and Akbar Hashemi Rafsanjani, who was disqualified from the race by the powerful Guardian Council, a 12-member body of theologians and jurists.
However, Mr Rouhani faced a tough challenge from hardline candidates, including Mr Qalibaf – who is seen as a pragmatic conservative – and nuclear negotiator Saeed Jalili – who is said to be very close to the Supreme Leader, Ayatollah Ali Khamenei.
The other three candidates are Mohsen Rezai, a former head of the powerful Revolutionary Guards, former Foreign Minister Ali Akbar Velayati, and former Telecommunications Minister Mohammad Gharazi.
As polls closed, representatives of all six candidates issued a joint statement urging their supporters to remain calm until the official results were known.
“We ask people not to pay attention to rumours of victory parades being organised and to avoid gathering before the official results,” the statement said.
Earlier, Interior Minister Mostafa Mohammad Najjar told state TV that any presidential candidates unhappy with the results would have three days to lodge complaints to the Guardian Council.
President Ahmadinejad cast his ballot in Tehran accompanied by Vice-President Mohammad Reza Rahimi and government spokesman Gholam Hoseyn Elham, Fars news agency reported.
Millions of Iranians took to the streets to demand a re-run after the last presidential election in June 2009, when the supreme leader dismissed claims by the three defeated candidates of widespread fraud.
Two of them, former Prime Minister Mir Hussein Mousavi and senior cleric Mehdi Karroubi, became leaders of a nationwide opposition known as the Green Movement, after its signature colour.
They were placed under house arrested in February 2011 when they applied to stage a protest in support of the anti-government uprisings which were sweeping the Arab world. They are still being detained.
No foreign observers monitored this year’s election and there have also been concerns that media coverage in the run-up has been unfair.
Many reformist newspapers have been shut down, access to the internet and foreign broadcasters has been restricted, and journalists have been detained.
On Thursday, the BBC accused the Iranian authorities of “unprecedented levels of intimidation” of BBC employees’ families.
It said Iran had warned the families of 15 BBC Persian Service staff that they must stop working for the BBC or their lives in London would be endangered.
Tehran has so far made no comment on the allegation.
Rouhani maintaining his lead . Based on an initial total vote count of 5. 2 million votes, with 2.7 2 million votes he still commands more than 52 % of the vote followed by Tehran mayor Mohammad Baqer Qalibaf with 903,389 or 17.3%
In third place was Iran’s chief nuclear negotiator, Saeed Jalili, with 679,524 votes, followed closely by Mohsen Rezaei, a former head of the elite Revolutionary Guard, with 536,725 votes.
Trailing the field were former Foreign Minister Ali Akbar Velayati with 305,529 votes, and little-known former minister Mohammad Gharazi with 65,934 votes.
Error: No connected account.
Please go to the Instagram Feed settings page to connect an account.