Should I repeat after the muezzin or pray Tahiyyat al-masjid?
Question

When I enter the mosque and the muezzin is giving the call to prayer, should I pray Tahiyyat al-masjid (two rak’ahs for “greeting the mosque”) or should I repeat after the muezzin whilst standing, and then pay Tahiyyat al-masjid?.
Praise be to Allah.It is better for you to repeat after the muezzin and then pray Tahiyyat al-masjid, so that you will have done two acts of worship together, namely repeating after the muezzin then praying Tahiyyat al-masjid.  
But if that is on a Friday then it is better to hasten to pray Tahiyyat al-masjid, so that you can them focus on listening to the khutbah, because listening to the khutbah is more important that repeating after the muezzin. 
Shaykh Ibn ‘Uthaymeen was asked: If I enter the mosque and the muezzin is giving the call to prayer, is it better to pray tahiyyat al-masjid or to repeat after the muezzin?
 He replied: 
That depends. If you enter when the muezzin is giving the call for Jumu’ah prayer, the Adhan that is given when the khateeb is on the minbar, in this case we say that you should hasten to pray Tahiyyat al-masjid, and you should not wait until the muezzin has finished, because preparing yourself to listen to the khutbah is more important than repeating after the muezzin, as listening to the khutbah is obligatory and responding to the muezzin is not obligatory. 
But if the Adhan is not for Jumu’ah prayer, then it is better for you to remain standing until you have responded to the muezzin, and offered the well-known du’aa’ after the Adhan:  
Allahummah Rabba haadhihi’l-da’wat il-taammah wa’l-salaat il-qaa’imah, aati Muhammadan al-waseelata wa’l-fadeelah, wab’athhu maqaaman mahmoodan alladhi wa’adtahu innaka laa tukhlif al-‘mee’aad (O Allah, Lord of this perfect Call and the Prayer to be offered, grant Muhammad the privilege and also the eminence, and resurrect him to the praised position that You have promised, verily You do not break Your promise), 
Then after that you can pray Tahiyyat al-masjid.  
Fatawa Ibn ‘Uthaymeen, 14/295.