The Messenger of Allah ﷺ said, "When one of you rises from sleep at night, he should not dip his hand into the vessel until he has washed it three times, for he does not know where his hand has spent the night."
حدثنا مسدد حدثنا أبو معاوية عن الأعمش عن أبي رزين وأبي صالح
قال رسول الله ﷺ إذا قام أحدكم من الليل فلا يغمس يده في الإناء حتى يغسلها ثلاث مرات فإنه لا يدري أين باتت يده
Muslim narrated it in Sahih Muslim, Book of Purification, chapter on the dislike of dipping the hand of one performing ablution or another into water while in doubt, etc., hadith 278, from the hadith of Abu Muawiya Muhammad bin Khazim al-Darir, with this same chain.