Mishkat al-Masabih 165
He also said that God’s messenger led them in prayer one day, then faced them and gave them a lengthy exhortation at which their eyes shed tears and their hearts were afraid. A man said, “Messenger of God, it seems as if this were a farewell exhortation, so give us an injunction.” He then said, “I enjoin you to fear God, and to hear and obey even if it be an Abyssinian slave, for those of you .who live after me will see great disagreement. You must therefore follow my sunna and that of the rightly guided Caliphs. Hold to it and stick fast to it. 1 Avoid novelties, for every novelty is an innovation, and every innovation is error.” 

Ahmad, Abu Dawud, Tirmidhi and Ibn Majah transmitted it, but the last two did not mention the prayer.

1 Lit. :
Bite on it with the molar teeth.
وَعَنْهُ: قَالَ: صَلَّى بِنَا رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ذَاتَ يَوْمٍ ثُمَّ أَقْبَلَ عَلَيْنَا بِوَجْهِهِ فَوَعَظَنَا مَوْعِظَةً بَلِيغَةً ذَرَفَتْ مِنْهَا الْعُيُونُ وَوَجِلَتْ مِنْهَا الْقُلُوبُ فَقَالَ رَجُلٌ يَا رَسُولَ اللَّهِ كَأَنَّ هَذِهِ مَوْعِظَةُ مُوَدِّعٍ فَأَوْصِنَا قَالَ: «أُوصِيكُمْ بِتَقْوَى اللَّهِ وَالسَّمْعِ وَالطَّاعَةِ وَإِنْ كَانَ عبدا حَبَشِيًّا فَإِنَّهُ من يَعش مِنْكُم يرى اخْتِلَافًا كَثِيرًا فَعَلَيْكُمْ بِسُنَّتِي وَسُنَّةِ الْخُلَفَاءِ الرَّاشِدِينَ الْمَهْدِيِّينَ تَمَسَّكُوا بِهَا وَعَضُّوا عَلَيْهَا بِالنَّوَاجِذِ وَإِيَّاكُمْ وَمُحْدَثَاتِ الْأُمُورِ فَإِنَّ كُلَّ مُحْدَثَةٍ بِدْعَةٌ وَكُلَّ بِدْعَةٍ ضَلَالَةٌ» . رَوَاهُ أَحْمَدُ وَأَبُو دَاوُدَ وَالتِّرْمِذِيُّ وَابْنُ مَاجَهْ إِلَّا أَنَّهُمَا لَمْ يَذْكُرَا الصَّلَاةَ