Winning control of the Senate could enable the PML-N to change the constitution to make Sharif eligible to hold office again when the party contests a national election due later this year.
Total 135 candidates are contesting, including 20 from Pakistan People Party (PPP), 14 from Mutahida Qaumi Movement (MQM), 13 from Pakistan Tehreek-e-Insaf (PTI) and four from Pak Sarzameen Party. He has also been critical of Sharif's political scion Maryam Nawaz's role in the party at the decision-making level.
Lawmakers in the country's four provincial assemblies - Punjab, Sindh, Khyber Pakhtunkhwa, and Baluchistan - and the National Assembly were electing the 52 senators from among more than 130 candidates.
Pakistani lawmakers on Saturday began casting votes in secret for new senators in parliament's upper house in an election that looks set to boost the ruling party, as it tries to revive the political fortunes of ousted prime minister Nawaz Sharif.
Mushahid Hussain Sayed, who won a seat in the capital, Islamabad, said the senate victory vindicates Sharif's political "narrative" with voters. The other 52 were elected in 2015 and will retire in 2021.
Polling is taking place in Pakistan's four provincial assemblies and the federal parliament, with officials expecting final results to be announced later in the afternoon.
Pakistan's four provinces each have the same number of senate seats, but senators' votes are weighted by population.
PPP leader Aitzaz Ahsan, despite his party's "surprisingly good" performance in the Senate elections, congratulated PTI candidate Chaudhry Sarwar for being the only opposition member to win a Senate seat from Punjab.
However, the party candidates are supported by PML-N and will formally join it after the elections.
In Balochistan, a candidate needed just nine votes to become senator while in the biggest province of Punjab, 47 votes are needed to elect a senator.
Pakistan held elections for its Senate to elect 52 members of the house for the next six years on Saturday amid strict measures to ensure transparency, the Election Commission said.
Nearly all political parties have expressed dismay at the elections laws of Senate and promised to improve them.
Reports and allegations of massive use of money to buy votes have been doing rounds ahead of the elections.
National Assembly Speaker Ayaz Sadiq cast the first vote in the elections while Prime Minister Shahid Khaqan Abbasi also arrived in the assembly to cast his ballot.