مشكوة المصابيح Mishkat al-Masabih كتاب الصلاة The Book of Prayer
(الصَّلَاةُ الَّتِي صَلَّيْتَ مَرَّتَيْنِ تَكُونُ نَافِلَةً)

(A prayer prayed twice will be considered a nafl (optional) prayer)

1 hadith
Hadith 1155
وَعَن يَزِيدَ بْنِ عَامِرٍ قَالَ: جِئْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَهُوَ فِي الصَّلَاةِ فَجَلَسْتُ وَلَمْ أَدْخُلْ مَعَهُمْ فِي الصَّلَاةِ فَلَمَّا انْصَرَفَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ رَآنِي جَالِسا فَقَالَ: «ألم تسلم يَا زيد؟» قُلْتُ: بَلَى يَا رَسُولَ اللَّهِ قَدْ أَسْلَمْتُ. قَالَ: «وَمَا مَنَعَكَ أَنْ تَدْخُلَ مَعَ النَّاسِ فِي صَلَاتِهِمْ؟» قَالَ: إِنِّي كُنْتُ قَدْ صَلَّيْتُ فِي مَنْزِلِي أَحْسَبُ أَنْ قَدْ صَلَّيْتُمْ. فَقَالَ: «إِذَا جِئْتَ الصَّلَاةَ فَوَجَدْتَ النَّاسَ فَصَلِّ مَعَهُمْ وَإِنْ كُنْتَ قَدْ صَلَّيْتَ تَكُنْ لَكَ نَافِلَةً وَهَذِه مَكْتُوبَة» . رَوَاهُ أَبُو دَاوُد
Yazid b. ‘Amir said:I came to God’s Messenger when he was praying and sat down, but did not join the congregation in prayer. When he finished he saw me sitting and asked, “Have you not become a Muslim, Yazid?” I replied, “I certainly have become a Muslim, Messenger of God.” He asked, “What prevented you from joining the people in their prayer?” I replied, “I had already prayed at home, thinking you had prayed.” So he said, “When you come to prayer and find the people praying, pray along with them. If you have already prayed it will be a supererogatory prayer for you, though this is a prescribed prayer.” Abu Dawud transmitted it.
Hadith Reference Mishkat al-Masabih / The Book of Prayer / Hadith: 1155
Hadith Grading الألبانی: صَحِيح  |  زبیر علی زئی: إسناده ضعيف
Hadith Takhrij ´تحقيق و تخريج: محدث العصر حافظ زبير على زئي رحمه الله` «إسناده ضعيف، رواه أبو داود (577) ¤٭ نوح بن صعصعة: مجھول الحال، لم يوثقه غير ابن حبان.»