President Rodrigo Duterte declared martial law across the entire southern region of Mindanao in response to the crisis, which he described as the start of a major campaign by IS to establish a foothold in the Philippines.
Eighty-nine militants had been killed in the fighting and the amount of territory in the city that the remaining gunmen controlled had been cut to just 10 percent, military spokesman Brigadier-General Restituto Padilla said Wednesday.
However Padilla warned of more intense battles ahead, with the military believing three of the militants' main leaders were likely still in the city.
"That 10 percent is most likely the area that is heavily guarded and defended by any armed men if they are protecting any individual of high value," Padilla said.
The militants are also holding an unknown number of civilians hostage, according to Padilla and other authorities.
They initially took a priest and up to 14 other people hostage at the start of the crisis.
A video of the priest appeared on social media on Tuesday, in which he repeated the militants' demands to withdraw and said his captors were holding 240 people hostage.
Padilla said the number of people cited in the video as being held hostage could not be verified.
He insisted the release of the footage showed the militants were becoming increasingly desperate and said security forces would not back down.
"They are trapped, they are contained, they are in areas that they will never come up alive unless they surrender," Padilla said.
Another major complicating factor was the safety of about 2,000 residents who the local government said remained trapped in the militant-controlled areas, with troops, police and aid workers trying to rescue them.
"It was a terrible situation. We did not have anything to eat," Jenita Abanilla, 47, a laundrywoman, told reporters at an evacuation centre in Marawi on Wednesday shortly after heavily armed police brought her to safety.
Abanilla said she, her eight-year-old son, her husband plus eight other neighbours and relatives had often hid kneeling with their faces on the floor of her house.
"We covered the mouths of our children. We were afraid the gunmen would come in and kill us," she said, adding they were also scared of being hit by military bombs.
Padilla said Wednesday the militants had murdered 19 civilians but insisted that the military's "precision airstrikes" had not killed any of the trapped residents.
Twenty-one security forces had also died, Padilla said, bringing the combined death toll to 129.
The clashes erupted when security forces raided a house to arrest Isnilon Hapilon, a veteran Filipino militant regarded as IS's leader in the Philippines and who is on the US government's list of most-wanted terrorists.
Authorities said they were taken by surprise when dozens of gunmen emerged to protect Hapilon and then went on a rampage through Marawi, the Philippines' main Islamic city with a population of 200,000.
Hapilon was being protected by members of the local Maute group, a small band of militants who has declared allegiance to IS, according to the government.
Malaysians, Singaporean, Indonesian and other fighters had been involved in the unrest, according to the military.
Hapilon and the two Maute leaders -- brothers after whose surname the group is named -- were still believed to be in Marawi, local military spokesman Lieutenant Colonel Jo-ar Herrera told reporters.
A Muslim separatist rebellion in the southern Philippines has killed more than 120,000 people since the 1970s.
The main Muslim rebel groups have signed accords with the government aimed at forging lasting peace, giving up their separatist ambitions in return for autonomy.
The Maute and other hardline groups have rejected the peace process.