Whenever the Messenger of Allah ﷺ stood upon Safa, he would say "Allahu Akbar" three times and say, "There is no god but Allah alone, with no partner. To Him belongs the dominion, to Him belongs all praise, and He has power over all things." In the narration of Abdul-Rahman, he did this three times and supplicated, and he did the same upon Marwa.
قال قرأت على عبد الرحمن: مالك ح وحدثنا إسحاق أخبرنا مالك عن جعفر عن أبيه
أن رسول الله ﷺ كان إذا وقف على الصفا يكبر ثلاثا ويقول لا إله إلا الله وحده لا شريك له له الملك وله الحمد وهو على كل شيء قدير وفي حديث عبد الرحمن يصنع ذلك ثلاث مرات ويدعو ويصنع على المروة مثل ذلك
Its isnad is sahih. Muslim narrated it at length, 2/886, no. 1218, in the Hajj chapter, the Prophet's ﷺ pilgrimage, and similarly Abu Dawud, 2/189, no. 1905, and Nasai, 3/160, from Ibn Umar and Ibn Masud, and Ibn Majah, 2/1022, no. 3074, and Malik, 1/299, in the Hajj chapter, beginning the sai at Safa, and Darimi, 2/45.