The two leaders agreed to work together to bring Taliban insurgents to the negotiating table after meeting yesterday on the sidelines of a climate change conference in Paris, said officials.
The meeting came amid heightened tension over Kabul's accusations that Islamabad has historically aided the Taliban, most recently in the northern city of Kunduz, briefly captured by the militants in September as part of a nationwide surge in attacks.
Pakistan, which wields considerable influence over the militants, hosted a milestone first round of peace negotiations in July.
But the talks soon stalled when the Taliban belatedly confirmed the death of their longtime leader Mullah Omar.
Also Read
The United States and China have been pushing for the process to restart, but frosty ties between Islamabad and Kabul have hampered those efforts.
"There is no such thing as the Taliban after the death of Mullah Omar," Ghani said.
"There are groups of Taliban and we will engage in talking with some of them."
Taliban sources told AFP recently that the militants expect the talks to restart "very soon", possibly in the coming weeks, saying that Pakistan had been newly convinced that peace was in its best interests as it works with China to build a special economic corridor through the country.
Sharif also issued a statement Tuesday avowing Pakistan's close ties with its war-torn neighbour.
"Pakistan does not believe in any blame game, and instead would like to make renewed efforts to resurrect the peace and reconciliation process," he said, adding that it would have to be an Afghan-led process.
Hopes for better ties were high after Ghani's election last year. But they have since plummeted, with Kabul blaming Islamabad for a surge in Taliban violence in 2015.