Yahya related to me from Malik from Jafar ibn Muhammed ibn AIi from his father from Jabir ibn Abdullah that the Messenger of Allah ﷺ used to say, "Allah is greater" three times when he stopped on Safa, and "There is no god but Allah, alone, without any partner. To Him belong the Kingdom and praise, and He has power over everything" three times, and make dua. He would then do the same on Marwa.
أَنَّ رَسُولَ اللَّهِ ﷺ كَانَ إِذَا وَقَفَ عَلَى الصَّفَا يُكَبِّرُ ثَلاَثًا وَيَقُولُ لاَ إِلَهَ إِلاَّ اللَّهُ وَحْدَهُ لاَ شَرِيكَ لَهُ لَهُ الْمُلْكُ وَلَهُ الْحَمْدُ وَهُوَ عَلَى كُلِّ شَىْءٍ قَدِيرٌ يَصْنَعُ ذَلِكَ ثَلاَثَ مَرَّاتٍ وَيَدْعُو وَيَصْنَعُ عَلَى الْمَرْوَةِ مِثْلَ ذَلِكَ