I was sitting with the Messenger of Allah ﷺ when a man from among his companions came and said, "Messenger of Allah, I was stung last night and could not sleep until morning."The Prophet ﷺ asked, "By what?"He replied, "By a scorpion."The Prophet ﷺ said, "Had you said when evening came, 'I seek refuge in the perfect words of Allah from the evil of what He has created,' it would not have harmed you, Allah willing."
حدثنا أحمد بن يونس حدثنا زهير حدثنا سهيل بن أبي صالح عن أبيه قال سمعت
كنت جالسا عند رسول الله ﷺ فجاء رجل من أصحابه فقال يا رسول الله لدغت الليلة فلم أنم حتى أصبحت قال ماذا قال عقرب قال أما إنك لو قلت حين أمسيت أعوذ بكلمات الله التامات من شر ما خلق لم تضرك إن شاء الله
[Its chain of transmission is sahih] Nasai narrated it in Al-Kubra, no. 10430, and in Amal al-Yawm wal-Layla, no. 594, from the hadith of Zuhayr. Ahmad narrated it in 3/448 from the hadith of Suhayl, transmitted the same way. It also has another route in Muwatta (Yahya's recension), 2/951.