The Prophet ﷺ said, "The eye commits adultery, and the heart commits adultery. The adultery of the eye is the look, and the adultery of the heart is desire. The private parts then either confirm it or deny it."
حدثنا أبو النضر حدثنا المبارك عن الحسن
عن النبي ﷺ قال العين تزني والقلب يزني فزنا العين النظر وزنا القلب التمني والفرج يصدق ما هنالك أو يكذبه
Its chain of transmission is sahih. Abu Dawud narrated something similar in the Book of Marriage, and Tirmidhi narrated it in the Book of Purification.