Mishkat al-Masabih 1012
Abud Darda’ said:
God’s Messenger stood up to pray and we heard him say, “I seek refuge in God from you”, then say, “I curse you with God’s curse,” three times, then he stretched but his hand as though he was taking something. When he finished the prayer we said, “Messenger of God, we heard you say something during the prayer which we have not heard you say before, and we saw you stretch out your hand.” He replied, “God’s enemy Iblis came with a flame of fire to put it in my face, so I said three times, ‘I seek refuge in God from you’. Then I said three times, ‘I curse you with God’s perfect curse', but he did not retreat. Thereafter I meant to seize him. I swear by God that had it not been for the supplication of my brother Solomon, he would have been bound and made an object of sport for the Medina children.”*

* Cf. the tradition from Abu Huraira, p. 202. There it says, “my brother.” Here it is “our brother”, but the plural is often used for the singular.

Muslim transmitted it.
وَعَنْ أَبِي الدَّرْدَاءِ قَالَ: قَامَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَسَمِعْنَاهُ يَقُولُ: «أَعُوذُ بِاللَّهِ مِنْكَ» ثُمَّ قَالَ: «أَلْعَنُكَ بِلَعْنَةِ اللَّهِ» ثَلَاثًا وَبَسَطَ يَدَهُ كَأَنَّهُ يَتَنَاوَلُ شَيْئًا فَلَمَّا فَرَغَ مِنَ الصَّلَاةِ قُلْنَا يَا رَسُولَ اللَّهِ قَدْ سَمِعْنَاكَ تَقُولُ فِي الصَّلَاةِ شَيْئًا لَمْ نَسْمَعْكَ تَقُولُهُ قَبْلَ ذَلِكَ وَرَأَيْنَاكَ بَسَطْتَ يَدَكَ قَالَ: " إِنَّ عَدُوَّ اللَّهِ إِبْلِيسَ جَاءَ بِشِهَابٍ مِنْ نَارٍ لِيَجْعَلَهُ فِي وَجْهِي فَقُلْتُ أَعُوذُ بِاللَّهِ مِنْكَ ثَلَاثَ مَرَّاتٍ. ثُمَّ قُلْتُ: أَلْعَنُكَ بِلَعْنَةِ اللَّهِ التَّامَّةِ فَلَمْ يَسْتَأْخِرْ ثَلَاثَ مَرَّاتٍ ثُمَّ أَرَدْتُ أَخْذَهُ وَاللَّهِ لَوْلَا دَعْوَةُ أَخِينَا سُلَيْمَانَ لَأَصْبَحَ مُوثَقًا يَلْعَبُ بِهِ وِلْدَانُ أَهْلِ الْمَدِينَة. رَوَاهُ مُسلم