Pakistanis last went to the polls in February
The Pakistan Muslim League-Nawaz (PML-N) and the Pakistan People's Party (PPP) have won five by-election seats to the country's national parliament.
The PML-N won three seats while the PPP won two seats in Thursday's vote.
Polling was postponed for a sixth seat in the city of Lahore because of wrangling over whether former Premier Nawaz Sharif was eligible to contest.
The two parties also won 19 out of at least 23 provincial assembly seats where by-elections were held.
Election Commission Secretary Kanwar Mohammad Dilshad said that the two main parties "emerged as the main winners".
He said that in general the voting passed off peacefully, except for a few minor incidents of violence. Turnout was low, but he did not have exact figures.
The government appealed on Mr Sharif's behalf against a ban stopping him from running in a Lahore parliamentary seat.
He was barred because of convictions relating to his removal from power by Pervez Musharraf in 1999.
The results of Thursday's voting have not affected the balance of power in the national assembly.
Pakistan held general elections in February in which the PPP and the PML-N soundly defeated the party of US-backed President Musharraf.
But polling was delayed in a number of national and provincial parliamentary seats for a variety of reasons, including political unrest and candidates winning more than one seat.