That could be a concern for the United States, which has pushed Pakistan for years to take stronger action against a variety of Islamic militant groups, especially fighters staging cross-border attacks against American troops in Afghanistan.
As unofficial returns rolled in Sunday, a day after the election, state TV estimates put Sharif close to the majority in the national assembly needed to govern outright for the next five years. Even if he falls short of that threshold, independent candidates almost certain to swing in Sharif's favor would give his Pakistan Muslim League-N party a ruling majority.
That would put the 63-year-old Sharif in a much stronger position than the outgoing Pakistan People's Party, which ruled for five years with a weak coalition that was often on the verge of collapse.
Pakistan suffers from a growing energy crisis, with some areas experiencing power outages for up to 18 hours a day. That has seriously hurt the economy, pushing growth below 4 percent a year. The country needs a growth rate of twice that to provide jobs for its expanding population of 180 million.
Ballooning energy subsidies and payments to keep failing public enterprises afloat have steadily eaten away at the government's finances, forcing the country to seek another unpopular bailout from the International Monetary Fund. Pakistan also has an ineffective tax system, depriving the government of funds.
Sharif, the son of a wealthy industrialist, is seen by many as more likely to tackle the country's economic problems effectively because much of his party's support comes from businessmen. He is also expected to push for better relations with Pakistan's archenemy and neighbor India, which could help the economy.
The Pakistan People's Party was widely perceived to have done little on the economic front.
"Anything better than zero and you have already improved on the PPP's performance in terms of managing the economy," said Cyril Almeida, a columnist for Pakistan's Dawn newspaper.
The former ruling party was soundly beaten in Saturday's election. Sharif's party was leading in contests for 127 seats, just short of the 137 directly elected seats needed to form a majority, state TV said.
The PPP was ahead in contests for 32 national assembly seats, a significant drop from the 91 seats the party won in the 2008 election.
Independent candidates were leading in more than 20 contests, and they historically join the party that forms the government, which would leave the Pakistan Muslim League-N with a majority.
"I'm sure business and the economy will be far better in a couple of years," said Amir Nayaz, one of hundreds of Sharif supporters who gathered outside his home in Punjab's capital, Lahore, beating on drums, dancing and chanting slogans.
It was a remarkable comeback for the two-time prime minister, who was toppled in a 1999 coup by then-army chief Gen. Pervez Musharraf and was sent into exile in Saudi Arabia for years. He returned in 2007, and his party came in second in elections the following year.
Over the last five years, Sharif put steady pressure on the PPP-led government. But because he was wary of army interference, he never applied enough pressure to threaten the government's hold on power. That attitude helped enable parliament to complete its term and transfer power in democratic elections for the first time since the country was founded in 1947.
President Barack Obama praised "the historic peaceful and transparent transfer of civilian power."
In an ironic twist, the man who toppled Sharif in a military coup, Musharraf, is currently under house arrest in the country after returning from self-imposed exile. It will be up to Sharif's government to decide whether to bring treason charges against Musharraf in the Supreme Court.
Sharif's party managed to weather a serious challenge from former cricket star Imran Khan, whose criticism of the country's traditional politicians energized the youth. Even though Khan failed to deliver his promised "political tsunami," his Pakistan Tehreek-e-Insaf party did much better than it had historically.
It was leading in contests for 31 national assembly seats, state TV said, and appeared to be in position to possibly form the government in northwest Khyber Pakhtunkhwa province. The party boycotted elections in 2008 and only won one national assembly seat in 2002.
The Pakistani Taliban, which has been waging a bloody insurgency against the government, tried to derail the election with attacks. More than 150 people were killed with guns and bombs in the run-up to the election, including 29 on election day.
The deadly campaign failed to keep people away from the polls. Turnout was nearly 60 percent, the highest in more than 40 years, the election commission said. But the violence, which mainly targeted secular parties, may have helped candidates seen as taking a softer line toward the militants, like Sharif and Khan, because they were able to campaign more freely.
Sharif has called for negotiations with the Pakistani Taliban but hasn't said clearly whether he thinks army operations against the militants should continue until peace is achieved. His party, which has ruled Punjab for the past five years, has not taken any clear action against the powerful Lashkar-e-Taiba militant group based in that province. Those militants are blamed for the 2008 attack on the Indian city of Mumbai that killed 166 people.
"I don't think that these guys have enough understanding of the risk," said Imtiaz Gul, director of the Islamabad-based Center for Research and Security Studies, referring to Sharif's party members. "They think they cannot afford to stoke unnecessary trouble for them by cracking down on people or groups who are extremists or terrorists."
It's also unclear what Sharif's policy will be toward neighboring Afghanistan, where the U.S. plans to withdraw most of its combat troops by 2014 and is seeking help from Pakistan to negotiate peace with the Afghan Taliban. Pakistan and Afghanistan have long had tense relations.
Afghan President Hamid Karzai promised "full cooperation" with Pakistan's new government Sunday, but alluded to the often-hostile relationship between the two countries and suspicions that Islamabad has aided insurgents and contributed to Afghanistan's instability.
"We hope that the new elected government provides the ground for peace and brotherhood with Afghanistan" and cooperates "in rooting out terrorist sanctuaries," he said.
The U.S. and Pakistan have also had a troubled relationship, especially after the 2011 American raid that killed Osama bin Laden in a Pakistani army town.
Sharif is expected to be somewhat more nationalistic and protective of state sovereignty when it comes to relations with the U.S. than the outgoing government. He defied U.S. opposition to Pakistan's nuclear test in 1998 and has criticized unpopular American drone attacks targeting militants in the country. But that doesn't mean the relationship will radically change, especially since the army often plays a dominant role in foreign policy issues.
"At the end of the day, Sharif is a businessman, and he looks at these things through a kind of pragmatic analysis," Almedia said. "I don't see any reason for him to want ties with U.S. to be poor, tense or troublesome."