In the letter published Sunday on Rouhani's website, the Iranian president congratulated Johnson on becoming prime minister Wednesday.
Rouhani said he hoped Johnson's "only one visit to Tehran" while serving as U.K. foreign secretary in 2017 and now his tenure as prime minister lead to a "further deepening of bilateral and multilateral relations."
Johnson took office on Wednesday amid a spike in tensions in the Persian Gulf and a diplomatic standoff between Britain and Iran. Iran seized a British-flagged tanker in the Strait of Hormuz this month after the British navy helped seize an Iranian supertanker loaded with crude oil near Gibraltar.
The head of Iran's Atomic Energy Organization says the country has enriched 24 tons of uranium since its 2015 nuclear deal with world powers.
The nuclear accord included a stockpile limit of 300 kilograms. However, it also permits Iran to enrich uranium and export it, as it has to Russia in past years.
Atomic Energy Organization head Ali Akbar Salehi was quoted by state TV on Sunday as saying Iran "did not enrich 300 kilograms of uranium, but enriched 24 (metric) tons of uranium," or what is 24,000 kilograms (nearly 53,000 pounds.).
In recent weeks, Iran broke past the accord's limits on its stockpile of low-enriched uranium, but has not said by how much.
As tensions mount with Washington, Iran also began enriching uranium past the deal's 3.67% limit to 4.5%, a figure still far below weapon-grade levels of 90%.
Iran's deputy foreign minister says discussions in Vienna with representatives from nations that want to salvage an unraveling nuclear accord were "good."
Seyed Abbas Araghchi told reporters after Sunday's meeting ended that "the atmosphere was constructive, and the discussions were good."
He added: "I cannot say that we resolved everything" but all the parties were still "determined to save this deal."
Representatives from Germany, France, Britain, China, Russia and the European Union participated in the meeting. The United States withdrew from the 2015 accord last year.
Iran is pressuring the remaining parties to the deal to offset sanctions President Donald Trump reinstated after pulling the U.S. from the agreement.
A Royal Navy warship has arrived in the Persian Gulf to accompany British-flagged ships passing through the Strait of Hormuz, amid tensions after Iran seized a British tanker this month.
Britain's Ministry of Defense said Sunday that the HMS Duncan will join the Frigate HMS Montrose in the Gulf to defend freedom of navigation.
Defense Secretary Ben Wallace said the Royal Navy will escort U.K. vessels until a diplomatic resolution is found to secure the route again.
The British-flagged Stena Impero oil tanker was seized in the Strait of Hormuz a week ago. Some senior Iranian officials have suggested the ship was seized in retaliation for the British navy's role in seizing an Iranian supertanker off the coast of Gibraltar for violations of EU sanctions on oil sales to Syria.
The Strait of Hormuz links the Persian Gulf to the Gulf of Oman and is a vital waterway for oil tankers.
Representatives from Europe, China and Russia, nations that are still committed to the Iran nuclear deal, are meeting with Iran's representative in Vienna on Sunday to discuss how to salvage the unraveling accord.
The diplomats aim to examine issues linked to the implementation of the nuclear accord after Iran surpassed stockpile and enrichment limits set out in the deal.
Iran recently begun surpassing uranium enrichment limits in the 2015 nuclear deal, saying these moves can be reversed if the other parties to the agreement — Germany, France, Britain, China, Russia and the European Union — come up with enough economic incentives to offset the U.S. sanctions that President Donald Trump reinstated after pulling his country from the nuclear accord.
Experts warn that higher enrichment and a growing stockpile narrow the one-year window Iran would need to have enough material to make an atomic bomb, something Iran denies it wants but the deal prevented.