The resolution, presented by Leader of the Opposition in the Senate Aitzaz Ahsan, stated that a person who is not eligible to become a member of the parliament or has been disqualified cannot lead any political party.
The Senate or the upper house of the parliament passed the resolution with 52 senators voting in its favor and 28 voting against it.
The PML-N took full advantage of its position as the ruling party as President Mamnoon Hussain signed the controversial Election Act 2017 into law after it was bulldozed through the National Assembly amid pandemonium on the opposition benches.
Under The Representation of Peoples Act 1976, a disqualified person could not hold the office of a party.
The law was passed to allow the party to re-elect Sharif as its head.
Ahsan said that after the new law, even someone who has given up Pakistani citizenship, who is declared to be of an unsound mind or otherwise disqualified from holding public office by a court now can become the head of a party.
"The parliament is exposed to becoming hostage to a person who himself is barred from entering it," the resolution said.
Law Minister Zahid Hamid opposed the resolution when put forward for debate and said that every party has the right to choose its leader from one of its members.
The resolution is non-binding and of no legal value and hence just symbolic.