They were joined by the EU's deputy foreign policy chief Helga Schmid for the marathon session, aiming to end a stalemate which has dragged the negotiations beyond a March 31st deadline.
"We are a few metres... from the finishing line, but we are well aware that the final metres are the hardest," French Foreign Minister Laurent Fabius told reporters, as he arrived back in Switzerland to rejoin the negotiations.
The stakes were very high, he said, adding at issue was the question of non-proliferation, and "Iran's reintegration into the international community."
Kerry and Zarif spent a sleepless night, talking from 9:20 pm Wednesday until 5:50 am with just a small break in between, when the American diplomat met with his French and German counterparts, a US official said.
Diplomats and experts from Britain, China, France, Germany, Russia and the United States also remained hard at work all night with their Iranian counterparts in a luxury Lausanne hotel in a flurry of separate meetings, before finally breaking from the negotiations just before dawn.
"We're moving," Zarif said as he emerged for a breath of fresh air.
After 18 months of intense negotiations, it remained unclear if the six world powers and Iran will pin down the main contours of a deal to put a nuclear bomb out of Iran's reach.
The aim is to turn this into a comprehensive accord backed by specific technical commitments by June 30th when an interim deal struck in November — which saw Iran freeze certain nuclear activities in return for minor sanctions relief — expires.
Success would end a 12-year-old standoff. Failure may set the United States and Israel on a road to military action to thwart Iran's nuclear drive.
"Iran has shown its readiness to engage with dignity and it's time for our negotiating partners to seize the moment," Zarif told reporters late on Wednesday.
Iran had shown it wants "an entente" with the world, but it "will not accept submitting to force and excessive demands," Zarif said.
The White House said the talks were still "productive" and progress was being made.
"But if we are in a situation where we sense that the talks have stalled then yes, the United States and the international community is prepared to walk away," said White House spokesman Josh Earnest.
Iran's chief negotiator Abbas Araghchi had appeared hopeful Wednesday, saying he believed "that at the end of the day we will be able to come to a conclusion and a resolution for all issues."
He said there were two main sticking points — a mechanism for lifting crippling sanctions against the Islamic republic, and the country's research and development of new nuclear machinery.
Global powers want Iran to scale down its nuclear programme to extend the "breakout" time needed to assemble enough nuclear material to make a bomb, which Iran has always denied seeking.
But Iranian negotiators are under pressure from domestic hardliners not to give too much away — while also delivering on President Hassan Rouhani's promise to win the lifting of sanctions.
Global powers have refused an immediate end to all sanctions, preferring instead a phased suspension to enable them to be put back in place if Iran violates the deal.
US President Barack Obama also needs a deal which he can sell to hostile Republicans in Congress, who remain sceptical of Iran's pledges and are threatening to push for new sanctions from April 14th.
Republicans and US allies like Israel and Saudi Arabia fear that if too much of Iran's nuclear programme is left intact, it will still have the ability to obtain a nuclear bomb.