Ibn `Umar used to kill snakes but when Abu Lubaba informed him that the Prophet (ﷺ) had forbidden the killing of snakes living in houses, he gave up killing them.
Sahih al-Bukhari Book 59, Hadith 119