All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, sallallaahu 'alayhi wa sallam, is His slave and Messenger.
The verse you referred to, which is verse 140 of Soorat An-Nisaa’ [Quran 4:140], indicates that it is impermissible for a Muslim to be present in a place where a prohibited act is committed such that he sees it or hears it unless he does that for a valid purpose such as voicing disapproval of the actions of the perpetrators. The ruling in this regard applies to both physical presence in actual gatherings and virtual presence in online chat rooms and the like. A Muslim bears a sin for attending such gatherings without a Sharee'ah-acceptable reason.
It should be noted, though, that the part of verse that says (what means): {Indeed, you would then be like them} does not entail that the mere presence at such gatherings incurs committing disbelief. The likeness referred to in the verse denotes bearing a sin for that action, as explained by scholars.
At-Taahir ibn ‘Aashoor said in his Tafseer book At-Tahreer wat-Tanweer: “This similarity is intended to emphasize the prohibition in this regard in order to deter people from doing it. A believer does not become a hypocrite merely by sitting with the hypocrites, and the likeness is in regard to the sin, not to its extent; that is to say that you would be like them in being involved in sin.” [End of quote]
It should be noted that the Internet is a double-edged sword, so whoever uses it for a good purpose and for acquiring what benefits him in his religion and his worldly life, it becomes a blessing for him. On the other hand, whoever uses it for evil purposes, it becomes a source of misfortune for him. Therefore, a Muslim should be heedful of the evils that may be incurred by using the Internet and wisely avoid them.
Allah knows best.