Arriving in his home city of Davao after a trip to Japan, Mr Duterte said God gave him an ultimatum on the plane.
"I heard a voice telling me to stop swearing or the plane will crash in mid-air, and so I promised to stop," he told reporters at the airport.
Mr Duterte's blunt speaking, often directed at the West, has contributed to his popularity at home.
He called President Barack Obama a "son of a whore", called the European Union "hypocritical", threatened to leave the UN and accepted comparisons to Hitler, saying he would gladly kill three million drug addicts.
All were responses to criticisms of his bloody war on drugs, that has seen thousands of alleged drug dealers and users killed by police and vigilante groups.
Mr Duterte said he had promised God he would not "express slang, cuss words and everything", and said a "promise to God is a promise to the Filipino people".
But he suggested his promise might have its limits. Whether he will stick to not swearing when talking about the US, EU or arch political foe Senator Leila de Lima, will depend on timing, local media quoted him as saying.
Like most Filipinos, Mr Duterte is Roman Catholic, although he has boasted about his womanising and called the Pope a "son of a whore" for causing traffic jams during his visit.
The president has spoken about being abused by an American priest as a child, saying that informed his political views.
He recently said that the Philippines wanted "a separation" from long-standing ally the US, and wanted American troops to leave the country, possibly within two years.
Philippine President Rodrigo Duterte says he has promised God he will clean up his famously vulgar language.