In an effort to cut off another avenue used by online predators, several video-game companies have agreed to close the accounts of more than 3,500 registered sex offenders in New York State following an agreement with the attorney general’s office.

The agreement, which Attorney General Eric T. Schneiderman announced on Thursday, was intended to remove sex offenders from the online scrum of millions of video-game enthusiasts of all ages who play against strangers, connected through the Internet. Many games contain an audio or text component that allows players to communicate with one another.

Mr. Schneiderman warned that those methods of communication could allow sexual predators “to establish contacts with children they would never be able to establish” in parks or playgrounds.

Among the companies that agreed to close accounts linked to sex offenders were Microsoft, which runs the Xbox Live gaming network, and Sony, which runs the PlayStation Network. Other companies that closed accounts included Electronic Arts, Warner Brothers, Disney Interactive Media Group, Blizzard Entertainment and Apple, Mr. Schneiderman said.