We were with Ibn Umar on a journey. He led us in prayer, and when we finished, we left along with him. He turned and saw some people praying.He asked, "What are these people doing?"I replied, "They are performing voluntary prayers."He said, "If I were going to perform voluntary prayers, I would have completed my prayer in full. Nephew, I accompanied the Messenger of Allah ﷺ, and he never prayed more than two rakahs while traveling, until Allah took him. Then I accompanied Abu Bakr, and he never prayed more than two rakahs. Then I accompanied Umar, and he never prayed more than two rakahs. Then I accompanied Uthman, and he never prayed more than two rakahs, until Allah took them. And Allah says, 'Indeed, in the Messenger of Allah you have an excellent example' [Ahzab 33:21]."
حدثنا أبو بكر بن خلاد الباهلي حدثنا أبو عامر
كنا مع ابن عمر في سفر فصلى بنا ثم انصرفنا معه وانصرف قال فالتفت فرأى أناسا يصلون فقال ما يصنع هؤلاء قلت يسبحون قال لو كنت مسبحا لأتممت صلاتي يا ابن أخي إني صحبت رسول الله ﷺ فلم يزد على ركعتين في السفر حتى قبضه الله ثم صحبت أبا بكر فلم يزد على ركعتين ثم صحبت عمر فلم يزد على ركعتين ثم صحبت عثمان فلم يزد على ركعتين حتى قبضهم الله والله يقول {لقد كان لكم في رسول الله أسوة حسنة}
Bukhari narrated it in the chapter on shortening prayer, in the section on one who does not perform voluntary prayer after the obligatory prayer while traveling, hadith no. 1102, and Muslim narrated it in the book on the prayer of travelers, in the section on the prayer of travelers and shortening it, hadith no. 689, from the hadith of Isa bin Hafs, transmitted through him both in longer and shorter forms.