(Adds results and context)
By Mehreen Zahra-Malik and Mubasher Bukhari
ISLAMABAD/LAHORE, Pakistan Oct 11 (Reuters) - Pakistan's ruling party reclaimed a parliamentary seat on Sunday, according to unofficial results of a closely contested by-election seen as a referendum on Prime Minister Nawaz Sharif's rule after he swept to power in 2013.
The race for the NA-122 parliamentary seat in Punjab, Pakistan's richest province and Sharif's power base, pitted his Pakistan Muslim League-Nawaz (PMLN) party against the opposition Pakistan Tehreek-e-Insaf (PTI).
Unofficial results based on media tallies from all polling stations showed close Sharif ally Ayaz Sadiq winning with a narrow lead of around 4,000 votes over PTI candidate Aleem Khan.
Around 200,000 people voted out of 348,000 registered voters. Official results were due to be announced by the election commission on Monday morning.
Last year, PTI's leader, cricketer-turned-politician Imran Khan, led street protests in the capital for months, alleging rigging in the 2013 polls.
The protests forced Sharif to rely on the military to defuse the standoff, which gave them a greater say in foreign and security policy. Many in the military had opposed Sharif's election promise to improve relations with arch-rival India.
The NA-122 constituency fell vacant after an election tribunal voided Sadiq's victory there in 2013 over election-day irregularities.
The PTI had only ever won a single parliamentary seat - that of its leader - until 2013, when his promises of a crackdown on corruption and tax evasion by the wealthy won enough votes to form a government in the northwesterly province of Khyber Pakhtunkhwa and become the third-largest party in Pakistan.
A nationwide Gallup poll conducted this month found that 37 percent of voters favoured the PTI while 46 percent favoured the PMLN.
Security and the economy have improved under Sharif, although analysts say external factors have contributed.
Attacks by insurgents have fallen around 70 percent this year, partly due to a military offensive in the northwest and a military-led crackdown in the southern city of Karachi.
Annual inflation is at its lowest in a dozen years, largely due to lower oil prices. The economy is growing faster, although still not fast enough to absorb new entrants to the job market.
But the government has failed to crack down on corruption or improve tax collection from the wealthy, whose continued tax evasion is starving social services such as schools and hospitals of cash.
The PMLN says Aleem's promises of reform are undercut by his previous position as a minister under a military dictator, and by the PTI's failure to fulfil its election promises in Khyber Pakhtunkhwa, the province it rules.
"Where are the dams Imran was going to build?" said voter Zaman Naqvi, cradling a stuffed lion, PMLN's election symbol. "Where are all the uplift projects? Where are the improvements in education and health?" (Writing by Mehreen Zahra-Malik; Editing by Kevin Liffey)
Our Standards: The Thomson Reuters Trust Principles.