Al-Kāfi - Volume 3 > Facing Doubts about Salah (Prayer) As a Whole, Not Knowing if It Is Increased or Decreased, One Facing Mistakes Very Often, Mistakes in Optional Salah (prayer) and Mistakes of an Imam and Those behind Him
Hadith #1

1ـ مُحَمَّدُ بْنُ يَحْيَى عَنْ أَحْمَدَ بْنِ مُحَمَّدِ بْنِ عِيسَى عَنْ مُحَمَّدِ بْنِ خَالِدٍ عَنْ سَعْدِ بْنِ سَعْدٍ عَنْ صَفْوَانَ عَنْ أَبِي الْحَسَنِ (عَلَيْهِ الْسَّلام) قَالَ إِنْ كُنْتَ لاَ تَدْرِي كَمْ صَلَّيْتَ وَلَمْ يَقَعْ وَهْمُكَ عَلَى شَيْ‏ءٍ فَأَعِدِ الصَّلاَةَ.

1. Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad ibn ‘Isa from Muhammad ibn Khalid from Sa‘d ibn Sa‘d from Safwan who has said the following: “Abu al-Hassan, ‘Alayhi al-Salam, has said, ‘If you do not know how many Rak‘at you have performed and your guess does not settle anywhere, perform your Salah (prayer) again.’”