The bill was passed on Thursday with a simple majority in the National Assembly of Pakistan after a day of debate.
Opposition lawmakers opposed the move, saying it would give the president too much power and that it violated the constitution.
"The government decided to move the bill in the assembly to bring stability and ensure a smooth continuation of democracy," Minister of Parliamentary Affairs Shir Afghan said.
He added that the bill's passage should end all debate as to whether the president, who seized power in a bloodless coup in 1999, would also remain army chief.
Strengthening the fight
A spokesman for the ruling party, Tariq Azim Khan, said the bill would "strengthen our drive and commitment in the fight against terrorism".
In a deal with parliament's Islamic opposition last year, Musharraf pledged to step down as army chief in return for their support of constitutional amendments to boost the power of the presidency, including the ability to dismiss parliament and the prime minister, who runs day-to-day affairs of the state.
"The government decided to move the bill in the assembly to bring stability and ensure a smooth continuation of democracy"
Shir Afghan, minister of parliamentary affairs
During debate about the bill on Thursday, opposition lawmakers beat their desks, crowded the speaker's dais and chanted anti-Musharraf slogans of "Go, Musharraf, go!" and "No, Musharraf, no!"
"We reject this law," said Sadiq al-Faruq, spokesman for the main opposition Pakistan Muslim League Party, after it was passed.
He said the bill would in effect keep the country under military rule. He vowed to "launch a movement" to end this.