كتاب المساقاة
22  
The Book of Musaqah
(10)
Chapter: The command to kill dogs, and its abrogation. The prohibition of keeping dogs, except for hunting, farming, (herding) livestock and the like
(10)
بَاب الْأَمْرِ بِقَتْلِ الْكِلَابِ وَبَيَانِ نَسْخِهِ وَبَيَانِ تَحْرِيمِ اقْتِنَائِهَا إِلَّا لِصَيْدٍ أَوْ زَرْعٍ أَوْ مَاشِيَةٍ وَنَحْوِ ذَلِكَ
Sahih Muslim 1576 a

Sufyan b. Abu Zuhair (he was a person belonging to the tribe of Shanu'a and was amongst the Conpanions of Allah's Messenger [may peace be upon him ) said:

I heard Messenger of Allah (ﷺ) as saying: He who kept a dog (other than that) which is indispensable for watching the field or the animals would lose one qirat out of his deeds every day. As-Sa'ib b Yazid (one of the narrators) said: Did you hear it from Allah's Messenger (ﷺ)? He said: Yes. by the Lord of this mosque.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، قَالَ قَرَأْتُ عَلَى مَالِكٍ عَنْ يَزِيدَ بْنِ خُصَيْفَةَ، أَنَّ السَّائِبَ، بْنَ يَزِيدَ أَخْبَرَهُ أَنَّهُ، سَمِعَ سُفْيَانَ بْنَ أَبِي زُهَيْرٍ، - وَهُوَ رَجُلٌ مِنْ شَنُوءَةَ مِنْ أَصْحَابِ رَسُولِ اللَّهِ صلى الله عليه وسلم - قَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏ "‏ مَنِ اقْتَنَى كَلْبًا لاَ يُغْنِي عَنْهُ زَرْعًا وَلاَ ضَرْعًا نَقَصَ مِنْ عَمَلِهِ كُلَّ يَوْمٍ قِيرَاطٌ ‏"‏ ‏.‏ قَالَ آنْتَ سَمِعْتَ هَذَا مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ إِي وَرَبِّ هَذَا الْمَسْجِدِ ‏.‏
Reference : Sahih Muslim 1576a
In-book reference : Book 22, Hadith 75
USC-MSA web (English) reference : Book 10, Hadith 3828
  (deprecated numbering scheme)