صحيح مسلم
From Sahih Muslim (Hadith 4022):
In the hadith transmitted on the authority of Yahya, he (the Holy Prophet) permitted the keeping of dogs for (the protection of) herds, for hunting and (the protection of) cultivated land
Reference: Muslim 4022