I was riding behind the Prophet ﷺ when his mount stumbled, so I said, "May Satan perish."He said, "Do not say, 'May Satan perish,' for when you say that, he swells up until he becomes as large as a house and says, 'By my own power.' Instead, say, 'In the name of Allah,' for when you say that, he shrinks until he becomes as small as a fly."
كنت رديف النبي ﷺ فعثرت دابته فقلت: تعس الشيطان. فقال: لا تقل تعس الشيطان؛ فإنك إذا قلت ذلك تعاظم حتى يكون مثل البيت ويقول: بقوتي ولكن قل: بسم الله؛ فإنك إذا قلت ذلك تصاغر حتى يكون مثل الذباب.
Abu Dawud (4982) and Nasai in Amal al-Yawm wal-Layla (554) both narrated it through routes from Khalid Haddan, from Abu Tamima Hujaymi, from Abu Malih, from the one who rode behind the Prophet ﷺ, and he mentioned it. Its isnad is sahih. Abu Malih is Ibn Usama Hudhali, and Abu Tamima Hujaymi is Tarif bin Mujalid. There has been disagreement about its isnad, and what I have mentioned is the correct view, as stated by Nasai and Daraqutni in al-Ilal (3181).