It is narrated from Sayyiduna Anas (may Allah be pleased with him): "When the Messenger of Allah (peace and blessings be upon him) stopped at a place (during a journey), he would not depart from it until he had bid it farewell by offering two rak'ahs." In the narration of Imam Abu Ya'la it is mentioned likewise, except that he reported these words: "When he (peace and blessings be upon him) travelled (he would do so)." Likewise, Imam al-Bayhaqi also recorded it in his Sunan through Yahya bin Kathir from Sayyiduna Anas bin Malik (may Allah be pleased with him): "When the Messenger of Allah (peace and blessings be upon him) camped at a halting place, he would not leave from there until he had offered two rak'ahs of prayer at that place." This hadith has also been mentioned before in Kitab al-Hajj.
Hadith Gradingمحدثین:سكت عنه البوصيري، إسناده ضعيف؛ لضعف عثمان بن سعد الكاتب
Hadith Takhrij«عثمان بن سعد الكاتب البصري: ضعيف (من الحفظ)؛ وكيع ثقة» «(4301/1) أخرجه سنن الدارمي برقم: 2681، وأخرجه المعجم الأوسط للطبراني برقم: 34665» «(4301/3) أخرجه سنن النسائي برقم: 498، وأخرجه سنن أبي داود برقم: 1205، وأخرجه مسند أحمد برقم: 11794، وأخرجه فتح الباري برقم: 4617»