It is narrated from Sayyiduna Ali (may Allah be pleased with him) that he said: "The Messenger of Allah (peace and blessings be upon him) used to pray two rak'ahs immediately after every obligatory prayer, except the Fajr prayer and the Asr prayer."
And Abd al-Rahman (may Allah have mercy on him) said in his narration: "at the end of every prayer."
Abd bin Humayd (may Allah have mercy on him) narrated it in his Musnad through Abu Nu'aym (may Allah have mercy on him), from Sufyan (may Allah have mercy on him), like the narration of (Abd al-Rahman) Ibn Mahdi (may Allah have mercy on him).
Ishaq bin Rahwayh (may Allah have mercy on him) narrated it from Jarir (may Allah have mercy on him).
And Imam Abu Dawud (may Allah have mercy on him) narrated it in full through Muhammad bin Kathir (may Allah have mercy on him), from Sufyan (may Allah have mercy on him).
Imam al-Daraqutni (may Allah have mercy on him) was asked about this hadith, and he mentioned that Mu'awiyah bin Hisham (may Allah have mercy on him) narrated it from al-Thawri (may Allah have mercy on him), from Abu Ishaq (may Allah have mercy on him), from al-Harith (may Allah have mercy on him), from Sayyiduna Ali (may Allah be pleased with him).
Whereas the other companions of al-Thawri (may Allah have mercy on him) narrated it from him, from Abu Ishaq (may Allah have mercy on him), from Asim bin Damrah (may Allah have mercy on him), from Sayyiduna Ali (may Allah be pleased with him); and the preserved (mahfuz) narration is that of Asim (may Allah have mercy on him) from Sayyiduna Ali (may Allah be pleased with him).
Related hadith on this topic