Sayyiduna Sahl bin Hanzalah RA relates that "we accompanied Nabi SAWW on the expedition of Hunain. On account of the journey being extremely lengthy we were overtaken by nightfull. When i came to Nabi SAWW to attend the Salaah, i overhead a rider relating the following to him:
"O Nabi of ALLAH, i was riding ahead of your people and i ascended a certain mountain where i spoke to the tribe of Hawazin. They were going in the direction of Hunain with the wealth of their fathers, accompanied by their veiled women, as well as their cattle.
Upon hearing this, Nabi SAWW smiled and remarked, "InshaALLAH tomorrow all that wealth will be the booty for the Muslims!"
Nabi SAWW thereafter enquired, "who will guard us tonight?"
Anas bin Marthad RA replied "O Rasullulah, i will stand guard."
Nabi SAWW instructed him to mount his horse. He mounted his horse and presented himself before Nabi SAWW who said to him, "Go in the direction of that valley and stand guard at the upper part of it. Dont be deceived by the night (i.e remain there the entire night and do not leave before the night is definitely over)"
When dawn broke, Nabi SAWW came to his place of Salaah and performed 2 rakkats Salaat. HE SAWW then asked the people around him. "have you any information about rider (the guard)?"
The people replied, "Oh Rasullulah SAWW, we have no information about him up to now."
At that moment the takbeer was called out for Salaah. Rasullullah SAWW
turned towards the valley and commenced Salaah. After Salaah he remarked, "Glad tidings, your rider has returned to you."
We turned our attention towards the tress and the valley and we soon saw him emerge. He presented himself before Rasullulah SAWW and after greeting him said, "After departing from here i ascended the upper part of the valley in compliance to your instruction and remained there. When morning dawned i looked on both sided of the valley and observed that there was no enemy around."
Rasullulah SAWW asked him "Were you mounted upon the horse the entire night?"
He replied, "No, i dismounted for the purpose of Salaah and for answering the call of nature."
Rasulullah SAWW said, "you have made Jannah compulsory upon yourself. Now you will never suffer any loss, even if you do not perform a single deed."
(Abu Daweed, Baihaqi, Hayatus Sahabah)