Trump said on social media the US had agreed to a request by Pakistani mediators "to hold our Attack on the Country of Iran until such time as their leaders and representatives can come up with a unified proposal ... and discussions are concluded, one way or the other".
Pakistan's leaders have hosted peace talks in Islamabad to end a war that has killed thousands of people and shaken the global economy.
But even as he announced what appeared to be a unilateral ceasefire extension, Trump also said he would continue the US Navy's blockade of Iran's trade by sea, considered an act of war by Iran.
There was no response early on Wednesday to Trump's announcement from senior Iranian officials, although some initial reactions from Tehran suggested Trump's comments were being treated sceptically.
Tasnim News Agency, affiliated with the Islamic Revolutionary Guards Corps, said Iran had not asked for a ceasefire extension and repeated threats to break the US blockade by force.
An adviser to Iran's lead negotiator, the speaker of parliament Mohammad Baqer Qalibaf, said Trump's announcement may be a ploy.
Trump's wartime rhetoric has veered between extremes. In an expletive-filled threat against Iran only two weeks ago he promised that a "whole civilisation will die tonight", while at other times he has appeared keen to end the violence and market uncertainty.
With his announcement on Tuesday, Trump again pulled back at the last moment from his threats to bomb Iran's power plants and bridges.
United Nations Secretary General Antonio Guterres and others have condemned those threats, noting international humanitarian law forbids attacks targeting civilians and civilian infrastructure.
The US and Israel began the war on February 28 with aerial bombardments of Iran.
The conflict quickly spread to Gulf states that host US military bases and to Lebanon once the Iran-allied militant group Hezbollah joined the fighting.
As well as the human toll, the war has led to the virtual closure of the Strait of Hormuz, a vital choke point in global energy markets between Iran and Oman, sending oil prices soaring and fears that the global economy could enter a recession.
Oil prices turned lower, though still near $US100, after Trump's announcement.
Iran has repeatedly exploited its ability to control the passage of oil tankers and other ships in the strait in response to US and Israeli attacks.
Trump's extension to the ceasefire came as tentatively scheduled peace talks in Islamabad seemed on the verge of falling apart.
US Vice-President JD Vance, whose presence has been requested by the Iranians, had planned to return to Pakistan on Tuesday but a White House official said he had not yet departed Washington and was taking part in additional policy meetings.
Before Trump's latest announcement, a senior Iranian official told Reuters that Iran's negotiators had been willing to attend another round of talks if the US abandoned a policy of pressure and threats, and rejected negotiations aimed at surrender.
Iran has condemned the US Navy intercepting and seizing two commercial Iranian ships at sea as part of its blockade, the second earlier on Tuesday, with its foreign ministry accusing the US of "piracy at sea and state terrorism".
The US, joined by other countries, has condemned Iran for impeding freedom of navigation in the Strait of Hormuz.
A first session of talks 11 days ago produced no agreement, with much of the focus on Iran's stockpiles of highly enriched uranium.