The Friday before New Year’s, three tourists stood by a doorway on a Midtown Manhattan street, roller suitcases in hand. The visitors said they were waiting for directions to the apartment they booked on Airbnb Inc. Soon, a young woman greeted and led them into the lobby of a nearby building, the Cameo at 311 West 50th St.

It was just another day in the cat-and-mouse game between New York City and hosts who list short-term rentals there that are sometimes illegal. Some guests say they aren’t given an exact address and instead are met by a guide on a nearby street as hosts try to avoid unwanted attention.

City officials say they uncovered illegal activity at the Cameo anyway. On Wednesday, New York City filed suit against the property owner, the Torkian Group, accusing the firm of allowing a group of hosts to operate a network of illegal short-term rentals at the Cameo and at two other large buildings it owns in Manhattan.

The city said that the ring, operated by a commercial real-estate broker and a tax accountant, earned close to $1.2 million since 2015 in connection with 1,029 separate illegal rentals of 13 apartments at the three Torkian buildings in prime Manhattan neighborhoods.

The suit identified a team of hosts at the Cameo: David Tordjman, an executive vice president at commercial brokerage Norman Bobrow & Co., and Yohan Atlan, a tax accountant in Brooklyn.

Mr. Tordjman didn’t respond to several requests for comment. Asked if he earned nearly $1.2 million in the short-term rentals, Mr. Atlan said: “How much?” and then hung up the phone.

The Torkian Group, a New York building owner and developer founded by brothers Hersel and Behrooz Torkian, wasn’t accused of participating in the scheme at the three buildings.

The suit accused The Torkian Group of failing to stop “flagrant violations” of the city’s ban on rentals of apartments for fewer than 30 days at the three buildings—the Cameo, 110 Greenwich St. and 488 Seventh Ave—after receiving summonses for illegal short-term stays at each of the buildings.

It said the owners issued sworn statements that the problems were solved, but new violations were discovered months later, and in one case within a month. The Torkian Group didn’t respond to requests for comment.

It is illegal to rent out an entire apartment in New York City for fewer than 30 days, and the city has adopted stringent rules to clamp down.

With its latest lawsuit, city officials say they are fighting to stop illegal rentals, even as hosts adapt and find new ways to evade detection and avoid fines.

Airbnb and other listing sites say the city is acting at the behest of the hotel industry and is depriving New Yorkers of badly needed income. Airbnb is pushing for state legislation that would legalize many rentals and provide a stream of tax revenue to local governments.

“This case is a clear example of just one thing: the ongoing need for a comprehensive, statewide bill that would provide for strict recourse against the few bad actors while protecting the rights of regular New Yorkers,” said Josh Meltzer, head of Northeast policy for Airbnb.

A federal judge in Manhattan last week at least temporarily blocked a new city law that required listing companies to file monthly reports on each individual rental in the city, a setback for the city’s enforcement effort and a boon to the short-term rental industry.

Airbnb is planning an initial public offering and has committed to being ready for it by July 1. If efforts by New York and other cities to restrict short-term rentals succeed, they could be a drag on future prospects of the company.

To make the case against the Torkian buildings, city officials said they used administrative subpoenas for data from three listing sites—Airbnb, HomeAway and Trip Advisor—that allowed them to link listings with different host names and even different building addresses.

“We see a lot of sophisticated operations where several illegal rentals are being run at the same time by the same people, in homes that are intended for New Yorkers,” said Christian Klossner, director of the Mayor’s Office of Special Enforcement.

He called for better data and better cooperation from online rental platforms.

The suit doesn’t spell out how hosts had access to so many apartments in the Torkian buildings, or what the relationships—if any—between the building owners and the hosts were.

It noted that the hosts used multiple names, including “Yohan David, ” and used fake leases to hide illegal activity from inspectors, the city said.

City officials said they identified 44 illegal online listings, including 35 on Airbnb at the three Torkian buildings, as well as 230 illegal rentals in 19 buildings other than the ones cited in the lawsuit.

The hosts “have shown they will not stop the illegal transient occupancy unless ordered to do so by a court,” the suit said.