كتاب النكاح
16
The Book of Marriage
(2)
Chapter: Recommendation to the one who sees a woman and is attracted to her, to go to his wife or slave woman and have intercourse with her
(2)
باب نَدْبِ مَنْ رَأَى امْرَأَةً فَوَقَعَتْ فِي نَفْسِهِ إِلَى أَنْ يَأْتِيَ امْرَأَتَهُ أَوْ جَارِيَتَهُ فَيُوَاقِعَهَا

Jabir reported that Allah's Messenger (ﷺ) saw a woman, and so he came to his wife, Zainab, as she was tanning a leather and had sexual intercourse with her. He then went to his Companions and told them:

The woman advances and retires in the shape of a devil, so when one of you sees a woman, he should come to his wife, for that will repel what he feels in his heart.
حَدَّثَنَا عَمْرُو بْنُ عَلِيٍّ، حَدَّثَنَا عَبْدُ الأَعْلَى، حَدَّثَنَا هِشَامُ بْنُ أَبِي عَبْدِ اللَّهِ، عَنْ أَبِي الزُّبَيْرِ، عَنْ جَابِرٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم رَأَى امْرَأَةً فَأَتَى امْرَأَتَهُ زَيْنَبَ وَهْىَ تَمْعَسُ مَنِيئَةً لَهَا فَقَضَى حَاجَتَهُ ثُمَّ خَرَجَ إِلَى أَصْحَابِهِ فَقَالَ ‏ "‏ إِنَّ الْمَرْأَةَ تُقْبِلُ فِي صُورَةِ شَيْطَانٍ وَتُدْبِرُ فِي صُورَةِ شَيْطَانٍ فَإِذَا أَبْصَرَ أَحَدُكُمُ امْرَأَةً فَلْيَأْتِ أَهْلَهُ فَإِنَّ ذَلِكَ يَرُدُّ مَا فِي نَفْسِهِ ‏"‏ ‏.‏
Reference : Sahih Muslim 1403 a
In-book reference : Book 16, Hadith 10
USC-MSA web (English) reference : Book 8, Hadith 3240
  (deprecated numbering scheme)