It is narrated from the Prophet (peace and blessings be upon him): "Whoever does not complete the obligatory prayers, that shortfall will be made up from the voluntary (prayers)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / Q4000
Anas bin Hakim al-Dabbi (may Allah have mercy on him) narrates: Fearing Ziyad or Ibn Ziyad, I came to Madinah and met Sayyiduna Abu Hurayrah (may Allah be pleased with him). He said: Tell me your lineage. I told him my lineage, and he said: O young man, shall I not narrate a hadith to you? I said: May Allah have mercy on you. (Yunus (may Allah have mercy on him) says: I think he narrated it from the Prophet (peace and blessings be upon him).) He (peace and blessings be upon him) said: "On the Day of Resurrection, the first of their deeds that people will be questioned about is the prayer. Our Lord, the Mighty and Majestic, will say to the angels, although He knows everything: Look into the prayer of this servant of Mine: did he offer it properly and completely, or did he fall short in it? If it is complete, it will be recorded as complete. If there is some deficiency in it, Allah Almighty will say: See whether My servant has any voluntary prayers. If he has voluntary prayers, Allah Almighty will say: Complete the obligatory prayers of this servant of Mine from his voluntary ones. Then all deeds will be reckoned according to this same principle."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4000
Hadith Gradingمحدثین:حسن لغيرهٖ
Hadith Takhrij«حسن لغيرهٖ۔ أخرجه ابن الجاشيبة 34242»
(a) The same hadith is narrated through another chain: Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates something similar from the Prophet (peace and blessings be upon him).
(b) In this hadith there has been disagreement over al-Hasan through many chains, and the chain we have mentioned is, if Allah wills, the most authentic of them.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4001
Sayyiduna Tamim al-Dari (may Allah be pleased with him) narrates that he (peace and blessings be upon him) said: "On the Day of Resurrection, the first thing a servant will be questioned about is the prayer. If his prayer turns out to be complete, it will be recorded as complete; and if his prayer is not complete, Allah Almighty will say to His angels: See whether this servant of Mine has any voluntary prayers. If he has, then make up the shortfall in the obligatory prayers with those voluntary ones. Then zakah will be reckoned in the same way, and then all deeds will be reckoned according to this same principle."
Hammad bin Salamah narrated it as marfu' (from the Prophet), while others narrated it as mawquf (as the words of the Companion).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4002
(a) Sayyiduna Tamim al-Dari (may Allah be pleased with him) narrates: "On the Day of Resurrection, the first thing a person will be questioned about is the obligatory prayer. If his prayer turns out to be complete, the rest of his reckoning will be taken; and if there is some deficiency in his prayer, it will be said: See whether this person has any voluntary prayers. If he has voluntary prayers, his obligatory prayers will be completed with them; and if he has no voluntary prayers, his obligatory prayers will not be completed, and he will be seized and thrown into Hell."
(b) Yazid al-Raqashi narrated this from the Prophet (peace and blessings be upon him) through Sayyiduna Anas bin Malik (may Allah be pleased with him), and it has the same meaning as the narration of Sayyiduna Tamim al-Dari (may Allah be pleased with him) about prayer and zakah.
Musa bin Ubaydah, who is da'if (weak), narrated on this subject something that resembles the opposite of this.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4003
Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) narrates that he (peace and blessings be upon him) said: "O Ali, the example of one who does not complete his prayer is like that of a pregnant woman who, when the time of her delivery draws near, miscarries: she is neither the mother of a child nor still pregnant. And the example of the one who prays is like that of a merchant: his profit is not secured for him until his capital is secured for him. Likewise, the voluntary prayers of the one who prays are not accepted until he performs the obligatory ones."
Musa bin Ubaydah is not used as evidence, and there is disagreement over him concerning its chain: Zayd bin al-Hubab and Asbat bin Muhammad narrated it in this way, while Sulayman bin Bilal narrated it from Musa bin Ubaydah, from Salih bin Suwayd, from Ali, likewise as marfu'.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4004
(a) Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) said: "The example of one who does not complete his prayer is like that of a pregnant female who, when the time to give birth draws near, miscarries, so that neither the pregnancy remains nor the child. And the example of the one who prays is also like that of a merchant: his profit is not secured for him until his capital is secured for him. Likewise, the voluntary prayers of the one who prays will not be accepted until he performs the obligatory ones."
(b) If this hadith is authentic, it is to be interpreted as referring to the voluntary acts that are within the obligatory prayer, whose validity is tied to the validity of the obligatory prayer; and the earlier hadiths are to be interpreted as referring to voluntary prayers outside the obligatory ones, whose validity does not depend on the validity of the obligatory prayers. And Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4005