Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) narrates: We used to travel with the Prophet (peace and blessings be upon him). When he saw a town that he intended to enter, he would recite: 'Allahumma barik lana fiha' (O Allah, bless us in it (that is, the town).) He would recite this three times. 'Allahumma urzuqna hayaha, wa habbibna ila ahliha, wa habbib salihi ahliha ilayna' (O Allah, grant us its blessings, make us beloved to its inhabitants, and make the righteous among the inhabitants of this town beloved to us.)
Al-Tabarani recorded it in al-Mu'jam al-Awsat, and its chain is jayyid (good).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الأذكار / 17115