[Machine] The Messenger of Allah ﷺ would perform two units of prayer for a journey and four units of prayer for residents. Just as the prayer before and after the prayer of residents is preferable, so too is the prayer for a journey before and after it.
سَنَّ رَسُولُ اللهِ ﷺ يَعْنِي صَلَاةَ السَّفَرِ رَكْعَتَيْنِ وَسَنَّ صَلَاةَ الْحَضَرِ أَرْبَعَ رَكَعَاتٍ فَكَمَا الصَّلَاةُ قَبْلَ صَلَاةِ الْحَضَرِ وَبَعْدَهَا حَسَنٌ فَكَذَلِكَ الصَّلَاةُ فِي السَّفَرِ قَبْلَهَا وَبَعْدَهَا