It is a virtuous and commendable act to remain in masjid after one congregational Salat waiting for the next one, and remaining in the reading of the Qur’an, remembrance of Allah, etc. during this time. There are numerous virtues for such people in the Hadeeth:
Amongst the seven category of people who will be placed under the shade of the Mercy of Allah on the day of Accounts, when there will be no other shade besides the Mercy of Allah, is that person whose heart remains in Masjid whilst waiting for the next Salat after completing one Salat.
Angels pray for mercy for that person who remains in masjid in the same place where he performed his Salat in congregation.
Angels pray for his forgiveness.
Atonement of sins include remaining in masjid after one Salat waiting for the next (Mishkaat)
Therefore, brothers who remain in masjid after Salat waiting for the next one are doing a very virtuous deed, and are on the route to success of next life. If they spend the time with intention of I’tikaaf and remain engaged in reading Qur’an, zikar, nafl prayers or du’a, it will be even more virtuous. I make special request to such pious people to pray for a sinner like me.
On the other hand, those people who spend their time in such blessed place (that is a Masjid) talking, backbiting or doing something that disturbs others who are praying, it will result in great harm and sin, just as the virtues are great (for doing good).
Fataawa Aalamgiri mentions among 15 etiquettes of masjid the seventh one as, ‘no worldly talks should be carried out in masjid (page321 vol.5). It is an act of great sin to talk about worldly matters, backbite or indulge in unnecessary and useless talks. There are severe warnings in the Hadeeth in this regard: Talking in masjid wipes out good deeds just as fire destroys wood; or as animals eat away grass. This way all virtues are destroyed totally. Mosque is the court of Allah, the King of kings, so one should give due respect, keeping regards for the greatness of the King of kings. Mosque is not a center of vain talking. In a saying: A time will come on people when they will indulge in worldly talks and vain talks in masjid, so you must not sit with such people; Allah has no need for such people. (Bayhaqee)
In conclusion, time in masjid should be spent in worship, etc. and one should save himself from vain and worldly talks and backbiting. If anyone is doing so, he should be stopped with great love and respect.