At a hearing on Wednesday, lawyers for Hess told the judge that they agreed to extending the order for a month while they prepare a motion to dismiss the lawsuit. Castle’s lawyers said they were negotiating with the plaintiffs to reach a similar agreement.

The businesses that were raided last week as part of the criminal investigation included Statewide Oil and Heating in Brooklyn — a company that is among several that deliver oil for Hess and that until 2011 delivered for Castle — and four interrelated companies that deal in waste oil: County Oil Company and J. B. Waste Oil Company in Astoria, Queens; New York Oil Recovery Corporation in Brooklyn; and Paradise Heating Oil in Ossining, N.Y.

During the raids, investigators from several state, city and federal agencies — some wearing bright yellow head-to-toe protective suits — tested oil and seized computers, reams of records and other materials, carting away more than 100 boxes of documents from one company alone, according to officials and people briefed on the matter. They will examine transactions involving hundreds of millions of gallons of oil, some dating as far back as 10 years. The inquiry is in its early stages, one official said.

The investigation, which grew out of a 2007 federal case in which two defendants pleaded guilty and cooperated with prosecutors, will examine a number of aspects of the businesses, including how transactions were recorded, how shipments were logged and how oil was tested, one official said.

Robert F. Kennedy Jr. — a senior lawyer for the Natural Resources Defense Council, the president of Waterkeeper Alliance and one of the lawyers who brought the lawsuit against Castle — said the environmental impact of the company’s actions were stark.

“Basically, that company has turned every boiler or furnace that it services into a toxic-waste incinerator,” Mr. Kennedy said in an interview. “When you burn waste oil, there is a tremendous amount of not only benzene, toluene and xylene, which are known carcinogens, but in addition, there is an inventory of heavy metals that are extremely toxic, including mercury, lead, arsenic, cadmium, antimony and zinc.”

But Castle, in its court papers, argued that the lawsuit’s contention that it mixed its fuel with waste oil was based on a single test of one delivery that it made last year out of 108,000, and that the suit provides no details on who conducted the test or how it was performed.