Gunmen abducted the sailors on the high seas off the east coast of Malaysia's Sabah state on April 15, shooting and wounding another crew member.
Philippine Islamist group Abu Sayyaf was suspected of having carried out the kidnapping, the latest in a recent spree of abductions that saw them behead a Canadian hostage last month.
Indonesian President Joko Widodo announced in Jakarta that the men had been released and were in good health.
Philippine Foreign Secretary Rene Almendras thanked the Indonesian government for the "very close coordination" that helped secure the release of the hostages, and said efforts were aided by a recent deal aimed at halting the surge in abductions.
Also Read
Foreign ministers of Indonesia, Malaysia and the Philippines agreed last week to lauch joint patrols of a key waterway between their countries and to set up a hotline to communicate faster in emergencies and improve intelligence sharing.
The hostages were dropped off outside the house of local politician Abdusakur Tan on Jolo, a mountainous and jungle-clad island in the far south of the Philippines known to be an Abu Sayyaf stronghold.
The Indonesians' release was secured through "persuasion and joint efforts of the military and police, and the local and provincial government. No ransom was paid for the freedom of the Indonesians".
However, Abu Sayyaf does not normally release hostages without a ransom.
The Philippine military said the freed Indonesians were taken to a military base for medical check-ups.
"Arrangements are now being finalised for the handover of the Indonesian nationals to Indonesian authorities," it added in a statement.