Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:47:19

So know, ˹O Muhammad˺, that there is no deity except Allah and ask forgiveness for your sin and for the believing men and believing women. And Allah knows of your movement and your resting place.  

Know, then, that there is no god except God, that is to say, adhere, O Muhammad (s), to knowledge of this ˹fact˺ that will benefit you at the Resurrection, and ask forgiveness for your sin — this was said to him, despite his infallibility (‘isma), so that his community might emulate him ˹in this respect˺. Indeed he did do this. The Prophet (s) said, ‘Verily I do ask God for forgiveness a hundred times every day’ — and for the believing men and believing women — herein is an honouring for them, by having their Prophet enjoined to ask forgiveness for them. And God knows your going to and fro, your bustle during the day in pursuit of your business, and your place of rest, when you retire to where you sleep at night. In other words, He has knowledge of all your states, nothing of which can be hidden from Him, so be mindful of Him — the address ˹in this verse˺ is meant for believers as well as others.
القرآن:٤٧:١٩

فَاعْلَمْ أَنَّهُ لَا إِلَٰهَ إِلَّا اللَّهُ وَاسْتَغْفِرْ لِذَنْبِكَ وَلِلْمُؤْمِنِينَ وَالْمُؤْمِنَاتِ ۗ وَاللَّهُ يَعْلَمُ مُتَقَلَّبَكُمْ وَمَثْوَاكُمْ  

(فاعلم أنه لا إله إلا الله) أي دم يا محمد على علمك بذلك النافع في القيامة (واستغفر لذنبك) لأجله قيل له ذلك مع عصمته لتستن به أمته، وقد فعله قال ﷺ : "" إني لأستغفر الله في كل يوم مائة مرة "" (وللمؤمنين والمؤمنات) فيه إكرام لهم بأمر نبيهم بالاستغفار لهم (والله يعلم متقلبكم) متصرفكم لأشغالكم في النهار (ومثواكم) مأواكم إلى مضاجعكم بالليل، أي هو عالم بجميع أحوالكم لا يخفى عليه شيء منها فاحذروه، والخطاب للمؤمنين وغيرهم.

See similar narrations below:

Collected by Ṭabarānī
tabarani:13783Aḥmad b. Zuhayr al-Tustarī > Muḥammad b. Yaḥyá al-Azdī > Ibn al-Muḥabbar > Saʿīd b. Rāshid > ʿAbd al-Raḥman b. Ziyād b. Anʿam > ʿAbd al-Raḥman b. Rāfiʿ > ʿAbdullāh b. ʿAmr

[Machine] The Messenger of Allah ﷺ said, "There is no remembrance better than La ilaha illa Allah (there is no god but Allah) and no supplication better than istighfar (seeking forgiveness)." Then the Messenger of Allah recited, "So know, [O Muhammad], that there is no deity except Allah and ask forgiveness for your sin and for the believing men and believing women."  

الطبراني:١٣٧٨٣حَدَّثَنَا أَحْمَدُ بْنُ زُهَيْرٍ التُّسْتَرِيُّ قَالَ أنا مُحَمَّدُ بْنُ يَحْيَى الْأَزْدِيُّ قَالَ ثنا ابْنُ الْمُحَبَّرِ قَالَ ثنا سَعِيدُ بْنُ رَاشِدٍ عَنْ عَبْدِ الرَّحْمَنِ بْنِ زِيَادِ بْنِ أَنْعَمَ عَنْ عَبْدِ الرَّحْمَنِ بْنِ رَافِعٍ عَنْ عَبْدِ اللهِ بْنِ عَمْرٍو قَالَ

قَالَ رَسُولُ اللهِ عَلَيْهِ وَسَلَّمَ «مَا مِنَ الذِّكْرِ أَفْضَلُ مِنْ لَا إِلَهَ إِلَّا اللهُ وَلَا مِنَ الدُّعَاءِ أَفْضَلُ مِنَ الِاسْتِغْفَارِ» ثُمَّ تَلَا رَسُولُ اللهِ ﷺ {فَاعْلَمْ أَنَّهُ لَا إِلَهَ إِلَّا اللهُ وَاسْتَغْفِرْ لِذَنْبِكَ وَلِلْمُؤْمِنِينَ وَالْمُؤْمِنَاتِ}