It is narrated from Sayyiduna Tariq bin Ashyam al-Ashja'i (may Allah be pleased with him), who had prayed behind the Prophet (peace and blessings be upon him), that the Prophet (peace and blessings be upon him) said: "Whoever sees me in a dream has truly seen me, for Satan cannot take my form."
Imam Ahmad (may Allah have mercy on him) narrated this hadith through Husayn bin Muhammad, from Khalaf bin Khalifah.
And Imam al-Tirmidhi (may Allah have mercy on him) narrated it in "al-Shama'il" through Qutaybah bin Sa'id.
It has a supporting narration (shahid) in Sahih Muslim, through Muhammad bin Sirin (may Allah have mercy on him), from the hadith of Sayyiduna Abu Hurayrah (may Allah be pleased with him).