Saad bin Abu Waqqas reported,

The Messenger of Allah ﷺ said, "Whoever says when he hears the caller to prayer, 'I bear witness that there is no god but Allah alone, with no partner, and that Muhammad is His servant and His Messenger. I am content with Allah as Lord, with Muhammad as Messenger, and with Islam as religion,' his sins will be forgiven."In another narration, "Whoever says when he hears the caller to prayer, 'And I too bear witness...'"

Azami 10987

Sahih

عن سعد بن أبي وقاص

عن رسول الله ﷺ أنه قال: من قال حين يسمع المؤذن: أشهد أن لا إله إلا الله وحده لا شريك له، وأن محمدا عبده ورسوله، رضيت بالله ربا، وبمحمد رسولا، وبالإسلام دينا غفر له ذنبه… وفي رواية: من قال حين يسمع المؤذن: وأنا أشهد…

الأعظمي 10987صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Supplications of adhan and prayer, and what is related to them
Section
What to say upon hearing the call to prayer
Numbering
Jami al-Kamil 10987 (2nd edition)
Azami 10987