Many of those rescued had jumped off the MV Lady Mary Joy 3 in panic at the height of the fire on Wednesday night and were plucked from the sea by the coastguard, navy, another ferry and local fishermen, said governor Jim Hataman of the southern island province of Basilan.
The search and rescue effort was continuing on Thursday for at least seven missing passengers.
The burned ferry was towed to Basilan's shoreline, where coastguard personnel and other authorities discovered 18 of the bodies in a budget section of the passenger cabin, Hataman said, adding the search of the vessel was continuing.
"These victims perished onboard due to the fire," he said.
He said an investigation was under way and the discovery suggested there were additional travellers not listed on the vessel's manifest.
The ferry was on the way to Jolo town in Sulu province from the southern port city of Zamboanga when it caught fire midway off Basilan close to midnight, he said.
At least 23 passengers were injured and taken to hospital.
"Some of the passengers were roused from sleep due to the commotion caused by the fire. Some jumped off the ship," Mr Hataman told the Associated Press by telephone.
Sea accidents are common in the Philippine archipelago because of frequent storms, badly maintained boats, overcrowding and patchy enforcement of safety regulations, especially in remote provinces.
In December 1987, the ferry Dona Paz sank after colliding with a fuel tanker, killing more than 4300 people in the world's worst peacetime maritime disaster.