What is the ruling of performing sunnah prayer after Asar? For example, if I want to perform sunnah repentance prayer or sunnah hajat prayer after Asar.
Alhamdulillah, praise and thanks to Allah for the many countless blessings He has blessed us all with. Blessings and salutations to the Prophet Muhammad PBUH, his wives, his family, companions and all those that follow his teachings to the day of judgement.
There are several times in a day when it is prohibited to perform prayers (sunnah). This is in accordance with a hadith from Ibn ‘Abbas R.Anhuma:
أَنَّ النَّبِيَّ صلى الله عليه وسلم نَهَى عَنِ الصَّلاَةِ بَعْدَ الصُّبْحِ حَتَّى تَشْرُقَ الشَّمْسُ، وَبَعْدَ الْعَصْرِ حَتَّى تَغْرُبَ.
"The Prophet (ﷺ) forbade praying after the Fajr prayer till the sun rises and after the `Asar prayer till the sun sets."
Sahih al-Bukhari (581)
In another hadith from Abu Hurairah RA:
أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم نَهَى عَنِ الصَّلاَةِ بَعْدَ الْعَصْرِ حَتَّى تَغْرُبَ الشَّمْسُ وَعَنِ الصَّلاَةِ بَعْدَ الصُّبْحِ حَتَّى تَطْلُعَ الشَّمْسُ
The Messenger of Allah, may Allah bless him and grant him peace, forbade prayer after Asar until the sun had set, and prayer after Subuh until the sun had risen.”
Sahih Muslim (825)
Al-Imam al-Nawawi Rahimahullah (w.676H) said that the time stated in the above hadith is a restriction for any type of sunnah prayer after the obligatory Asar prayer. As for nawafil sunnah prayer (for which the sunnah prayer is for a reason), such as sunnah prayer of tahiyyatul masjid, sujud tilawah, and sujud syukur, al-‘Eid prayer, al-Kusuf (eclipse) prayer, janazah prayer and, replacing a missed obligatory prayer, mazhab al-Syafi’e ruled it permissible and not makruh (undesirable). As for mazhab Abu Hanifah and others, they prohibit it for they determined that it is included in the generality of the hadith’s restriction. 
According to al-Mu’tamad, it is ruled as makruh tahrim (makruh that is near to prohibition). However, there are a few exceptions for this ruling in a few situations:
- Nawafil Sunnah Prayer (for which there is a reason for the prayer): It is not makruh (undesirable) for every prayer performed for which there is a reason for the prayer. For example, if someone wants to qadha’ (replace) his obligatory prayer, for jenazah prayer, solar or lunar eclipse prayer, prayer asking for rain, tawaf prayer, and tahiyyatul masjid prayer. If we review these prayers, all of them are performed when there is a specific reason or situation for it.
- During the meridian (when the sun is overhead at noon) on Friday: It is not makruh to pray during this time for those who are attending the Friday prayer. In a hadith from Abu Sa’id al-Khudri RA, he said:
أَنَّهُ كَرِهَ الصَّلَاةَ نِصْفَ النَّهَارِ إِلَّا يَوْمَ الْجُمُعَةِ
“The Prophet (ﷺ) disapproved of the offering of prayer at the meridian except on Friday.”
Sunan Abu Daud (1083)
- Prayer in the Holy Land of Mecca: It is not makruh to pray at any time in the holy land of Mecca, whether there is a reason or not for the prayer. This is in accordance with a hadith from Jubair bin Mut’im RA, where the Prophet PBUH said:
لاَ تَمْنَعُوا أَحَدًا يَطُوفُ بِهَذَا الْبَيْتِ وَيُصَلِّي أَىَّ سَاعَةٍ شَاءَ مِنْ لَيْلٍ أَوْ نَهَارٍ
“Do not prevent anyone from going around this House (the Ka'bah) and from praying any moment he desires by day or by night.”
Sunan Abu Daud (1894) and Sunan al-Nasa’ie (586)
Thus, Islamic scholars agreed that it is permissible to do tawaf or pray in Mecca at any time according to the above hadith.
There are Prophetic evidences that restrict performing the sunnah prayers at certain times of day as stated in the above hadiths. Hence, in fiqh, it is ruled as makruh to perform any sunnah prayer after Asar, with the few exceptions of the stated prayers in the discussion above. Wallahua’lam.
 See Al-Minhaj Syarh Sahih Muslim. Dar Ihya’ al-Turath al-‘Arabi, (6/110).