The Messenger of Allah ﷺ used to instruct us not to remove our leather socks for three days except in the case of major ritual impurity, but not for relieving ourselves or sleeping.
حدثنا أبو بكر بن أبي شيبة حدثنا سفيان بن عيينة عن عاصم عن زر
كان رسول الله ﷺ يأمرنا أن لا ننزع خفافنا ثلاثة أيام إلا من جنابة لكن من غائط وبول ونوم
[Its chain is hasan] Tirmidhi transmitted it in "Purification," chapter "Wiping over the socks for the traveler and the resident," no. 96, and others also transmitted it, as did Nasai, no. 126, 127, and others besides them, from the hadith of Asim, by this route, and Tirmidhi said, hasan sahih.