That the Messenger of Allah (ﷺ) said: "When a snake appears in your dwellings then say to it: We ask you - by covenant of Nuh, and by the covenant of Sulaiman bin Dawud - that you do not harm us.' If it returns, then kill it."
Jami` at-Tirmidhi Book 18, Hadith 27