Abu Saaib reported,

I came to Abu Saeed Khudri, and while I was sitting with him, I heard something moving beneath his bed. I looked, and there was a snake. I stood up.Abu Saeed asked, "What is the matter with you?"I said, "There is a snake here."He said, "What do you want to do?"I said, "I want to kill it."He pointed to a room in his house facing his own room and said, "A cousin of mine was staying in this room. On the day of the Battle of the Confederates, he asked permission from the Messenger of Allah ﷺ to visit his wife, as he was newly married. The Messenger of Allah ﷺ gave him permission and ordered him to take his weapon with him.He came to his house and found his wife standing at the door of the room. He raised his spear at her, but she said, 'Do not be hasty until you see what made me come out.' He entered the room, and there was a hideous snake. He struck it with his spear, then came out carrying it on the spear while it writhed. I do not know which of them died first, the man or the snake.His people came to the Messenger of Allah ﷺ and said, 'Pray to Allah to bring our companion back to life.'He said, 'Seek forgiveness for your companion.' Then he said, 'A group of the jinn have accepted Islam in Medina. If you see any of them, warn it three times. Then, if it appears to you again after that, you may kill it after the three warnings.'"

Abu Dawud 5257

Sahih

حدثنا يزيد بن موهب الرملي حدثنا الليث عن ابن عجلان عن صيفي أبي سعيد مولى الأنصار

عن أبي السائب قال

أتيت أبا سعيد الخدري فبينا أنا جالس عنده سمعت تحت سريره تحريك شيء فنظرت فإذا حية فقمت فقال أبو سعيد ما لك قلت حية هاهنا قال فتريد ماذا قلت أقتلها فأشار إلى بيت في داره تلقاء بيته فقال إن ابن عم لي كان في هذا البيت فلما كان يوم الأحزاب استأذن إلى أهله وكان حديث عهد بعرس فأذن له رسول الله ﷺ وأمره أن يذهب بسلاحه فأتى داره فوجد امرأته قائمة على باب البيت فأشار إليها بالرمح فقالت لا تعجل حتى تنظر ما أخرجني فدخل البيت فإذا حية منكرة فطعنها بالرمح ثم خرج بها في الرمح ترتكض قال فلا أدري أيهما كان أسرع موتا الرجل أو الحية فأتى قومه رسول الله ﷺ فقالوا ادع الله أن يرد صاحبنا فقال استغفروا لصاحبكم ثم قال إن نفرا من الجن أسلموا بالمدينة فإذا رأيتم أحدا منهم فحذروه ثلاث مرات ثم إن بدا لكم بعد أن تقتلوه فاقتلوه بعد الثلاث

أبو داود 5257صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Manners
Chapter
Killing snakes
Numbering
Darussalam 5257
Abu Dawud 5257