The Federal Energy Regulatory Commission said yesterday that four major oil and gas companies have agreed to a settlement of allegations of violations of federal natural gas regulations that will result in the return of up to $58.5 million to natural gas customers.

The agency said that Tenneco Inc., Sun Exploration and Production Co. and Atlantic Richfield Co. agreed to refund $40 million to interstate customers of Tennessee Gas Pipeline Co., a division of Tenneco. At the same time, Tenneco agreed to drop an appeal that had held up payment of $18.5 million that Mobil Oil Corp. had agreed to in a 1980 settlement.

FERC spokeswoman Rachelle Patterson said that Tenneco is determining which customers are due a return under the settlement but that they appear to include natural gas customers in Pennsylvania, New York, Massachusetts, Virginia and Illinois, and all the states in the Columbia Gas System, which would include Maryland and the District of Columbia. Tenneco is one of five suppliers serving the Columbia system.

It was not clear whether the refunds would result in a reduction in gas prices or a slower increase in those prices. The refunds were not expected to be significant in the Washington area.

The FERC had charged that Tenneco, through its subsidiary, had transferred more than 160 billion cubic feet of natural gas from the interstate market to the intrastate market without federal authorization. Prices on the intrastate market were generally higher than prices in the interstate market during the period from 1965 to 1975 when the alleged violations occurred.

None of the companies that agreed to the settlement admitted or denied the allegations of federal investigators.

Sun and Arco were alleged to have charged higher-than-permissible prices for natural gas sold to the intrastate pipline affiliate of Tenneco to which the gas was diverted. Sun agreed to return $10.5 million to Tennessee's interstate customers, and Arco agreed to refund $6.5 million. Both companies also agreed to pay $250,000 in civil penalties to the U.S. Treasury.

Tenneco agreed to pay up to approximately $23 million over the next five years, including $16 million in principal and up to $7 million in interest. According to FERC officials, the settlements amount to about two-thirds of the value of the natural gas allegedly diverted from Tennessee to the intrastate subsidiary.

FERC officials also said that they have issued an order to 18 other natural gas producers to show cause why they should not be found to have violated federal gas regulations. Those companies were not named.

"These matter involved highly complex and technical issues of both fact and law," said a spokesman for Tenneco. He also said that Tenneco first had called the matters to the commission's attention in 1977. "The uncertainty which has clouded these transactions for so many years will thus be put to rest by this settlement," according to the Tenneco statement.

Tenneco described the settlement as in the company's best interest because it eliminates the need for costly litigation. In the same sense, the settlement is also in the best interst of Tenneco's customers, the firm said.