(2) باب نَدْبِ مَنْ رَأَى امْرَأَةً فَوَقَعَتْ فِي نَفْسِهِ إِلَى أَنْ يَأْتِيَ امْرَأَتَهُ أَوْ جَارِيَتَهُ فَيُوَاقِعَهَا
Jabir heard Allah's Apostle (ﷺ) say:
When a woman fascinates any one of you and she captivates his heart, he should go to his wife and have an intercourse with her, for it would repel what he feels.
Reference: Sahih Muslim 1403c
In-book reference: Book 16, Hadith 12
USC-MSA web (English) reference(deprecated numbering scheme): Book 8, Hadith 3242