‘Abd al-Razzaq recorded it (11/456/20995), and al-Tabarani, through his chain, recorded it in al-Mu‘jam al-Kabir (9/195/8867), with a chain of transmission whose narrators are trustworthy, but which is interrupted.
I then found another chain for the hadith of Suhayb. Al-Tahawi said in Mushkil al-Athar (3/215): “Ahmad ibn Shu‘ayb narrated to us: Muhammad ibn Nasr informed us: Ayyub ibn Sulayman ibn Bilal narrated to us, from Abu Suhayl ibn Malik, from his father, that he used to hear ‘Umar ibn al-Khattab leading the people in prayer in the Mosque of the Messenger of Allah, may Allah bless him and grant him peace, from the house of Abu Jahm. He said: Ka‘b al-Ahbar said, ‘By Him who split the sea for Moses, Suhayb told me that Muhammad, the Messenger of Allah, may Allah bless him and grant him peace, never saw a town that he wished to enter without saying, when he saw it: “O Allah, Lord of the seven heavens and all that they overshadow …”’” He then mentioned the rest of the supplication, adding: “Ka‘b swore by Him who split the sea for Moses that these were David’s supplications whenever he saw the enemy.”
I say: This is an authentic chain of transmission. Its narrators are trustworthy and are narrators cited by al-Bukhari, apart from Muhammad ibn Nasr, who was al-Farra’ al-Naysaburi and was trustworthy. Ahmad ibn Shu‘ayb was Imam al-Nasa’i, the author of al-Sunan al-Sughra, known as al-Mujtaba (“The Selected”), which is the edition in print, and al-Sunan al-Kubra (“The Major Sunan”), which has not yet been printed. Only its Book of Ritual Purity has been printed, through the efforts of Shaykh ‘Abd al-Samad Sharaf al-Din—may Allah reward him well (1).
Al-Nasa’i also recorded it in its Book of Military Expeditions through this chain, as stated in Tuhfat al-Ashraf by al-Hafiz al-Mizzi (4/201). Likewise, al-Nasa’i recorded it in The Deeds of Day and Night (no. 343). Abu Suhayl’s name was Nafi‘ ibn Malik ibn Abi ‘Amir al-Asbahi, and both he and his father were narrators cited by al-Bukhari and Muslim.