Five police officers were wounded in the assault on Tuesday, Interior Secretary Angelo Reyes said.
"The crisis is over," he said. "The operation is terminated."
Police said they regained control of the prison about an hour after starting the assault. Troops outside fired tear gas as teams of police commandos scaled the walls of the four-storey detention centre and overpowered the men.
At least three leaders of the Abu Sayyaf group accused of involvement in high-profile seizures of foreigners were among those killed in the assault, police said.
Television reports said 300 policemen had stormed the building, where more than 400 prisoners, including 129 suspected Islamist fighters, were detained.
Police say a core group of 10 suspected Abu Sayyaf members had been holding out since killing three guards in an escape attempt on Monday.
Earlier in the day the men had offered to surrender in exchange for talks with high-profile Muslim leaders, including movie actor and Muslim convert Robin Padilla and southern Philippines Muslim legislator Mujib Hataman.
Sabdula alias Commander Global
was killed in Tuesday's attack
The prisoners had requested speedy trials, the right to air their grievances to the authorities and assurances they would not be harmed if they surrendered. Talks with the group broke down late on Monday.
Several loud blasts and gunfire were heard around the police detention centre in a Manila suburb shortly after an ultimatum issued by Reyes to the prisoners expired.
Tear gas still shrouded the building as television showed hundreds of prisoners milling around on the top floor.
Reyes said Alhamser Limbong, alias "Kosovo", Ghalib Andang, alias "Commander Robot", and Najdmi Sabdula, alias "Commander Global", were among the Abu Sayyaf leaders killed.
"The crisis is over. The operation is terminated"
Interior Secretary Angelo Reyes
Police said earlier that the uprising appeared to have been led by Limbong, who was accused of beheading an American hostage after a mass abduction from a Philippine beach resort in 2001.
Limbong had also been charged with carrying out a bomb attack on a ferry near Manila last year that killed at least 116 people.
The one-legged Andang and Sabdula were accused of leading the kidnapping of 21 people from Malaysia's Sipadan island in 2000.