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:24:56

And establish prayer and give zakah and obey the Messenger - that you may receive mercy.  

And establish prayer and pay the alms, and obey the Messenger, that perhaps you may find mercy, that is to say, ˹do so˺ hoping for mercy.
القرآن:٢٤:٥٦

وَأَقِيمُوا الصَّلَاةَ وَآتُوا الزَّكَاةَ وَأَطِيعُوا الرَّسُولَ لَعَلَّكُمْ تُرْحَمُونَ  

{وأقيموا الصلاة وآتوا الزكاة وأطيعوا الرسول لعلكم ترحمون} أي رجاء الرحمة.

See similar narrations below:

Collected by Qurʾān
quran:3:132

And obey Allah and the Messenger that you may obtain mercy.  

And obey God and the Messenger, so that you may find mercy.
القرآن:٣:١٣٢

وَأَطِيعُوا اللَّهَ وَالرَّسُولَ لَعَلَّكُمْ تُرْحَمُونَ  

{وأطيعوا الله والرسول لعلكم ترحمون}.