Hadith 8219

وَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : قَالَتْ الْمَلَائِكَةُ : رَبِّ ذَاكَ عَبْدُكَ يُرِيدُ أَنْ يَعْمَلَ سَيِّئَةً ، وَهُوَ أَبْصَرُ بِهِ ، فَقَالَ : " ارْقُبُوهُ ، فَإِنْ عَمِلَهَا فَاكْتُبُوهَا لَهُ بِمِثْلِهَا ، وَإِنْ تَرَكَهَا فَاكْتُبُوهَا لَهُ حَسَنَةً ، إِنَّمَا تَرَكَهَا مِنْ جَرَّايَ " .
And the Prophet Muhammad (peace and blessings be upon him) said: The angels say, "O Lord, Your such-and-such servant intends to commit a sin." Allah, although He sees him well, says to the angel, "Keep watch over him. If he commits the sin, then write only as much as he has done, and if he refrains from the sin, then write a good deed for him, because he refrained from the sin for My sake."
Hadith Reference مسند احمد / مسند المكثرين من الصحابة / 8219
Hadith Grading حکم دارالسلام: إسناده صحيح، خ: 7501، م: 129