The Messenger of Allah ﷺ said four rak'ahs in the noon prayer while at Medina, but he offered two rak'ahs in the afternoon prayer at Dhu'l-Hulaifa. (Using translation from Muslim 690a)
أَنَّ رَسُولَ اللهِ ﷺ صَلَّى الظُّهْرَ بِالْمَدِينَةِأَرْبَعًا وَصَلَّى الْعَصْرَ بِذِي الْحُلَيْفَةِ رَكْعَتَيْنِ