Several major oil companies - including Mobil Corp. and Shell Oil Co. - reported higher second-quarter profits yesterday that reflect higher oil and gas prices. But two of the country's top five producers, Standard Oil Co. of California and Gulf Oil Corp., said earnings declined.

Among other companies in diverse industries, substantial increases in profitability were reported by Bethlehem Steel Corp., Pan American World Airways and General Foods Corp.

Profits in the quarter ended June 30 surged 21 percent for Mobil, the second largest U.S. oil firm after Exxon Corp., but fell 19 per cent for Gulf, which ranks fifth in size.

Mobil, citing improved foreign refining and marketing results and higher crude production in the North Sea, reported its second-quarter profits increased to $295 million $2.78 a share) from the $244 million ($2.30) reported for 1977's second quarter. Revenues were $8.9 billion compared with $8.4 billion.

For the six-month period, Mobil profits rose 15.7 percent to $536 million ($5.06 a share) from $463 million ($4.37) a year ago. Chairman Rawleigh Warner said foreign energy operations were up $65 million from the same period last year and real estate income increased $18 million. The firm, which owns the Montgomery Ward retail chain, recently acquired undeveloped land in Reston, Va.

Gulf Oil second-quarter earnings, suffering from a "squeeze" on profit margins, declined to $175 million (90 cents a share) from $216 million ($1.11) during the second quarter of 1977. Profits during the first half of 1978 declined to $330 million ($1.69 a share) from $382 million ($1.96) earned during a similar period a year ago.

Revenues of $4.72 billion in the quarter and 9.60 billion in the six months compared with revenues of $4.82 billion and $9.67 billion during the respective 1977 periods.

Jerry McAfee, Gulf's chairman, said that despite the disappointing results, "We are encouraged by the fact that the principal areas of our business, particularly in the U.S., showed improvement over the first three months of this year."

Standard Oil Co. of California, the fourth largest producer, reported a 6 percent decline in second-quarter profits, partly because of the negative effect of currency translations. Socal's earnings were $255 million ($1.50 a share) compared with $274 million ($1.60) a year earlier on revenues of $6.05 billion compared with $5.56 billion.

For the six months, Socal said its profits slipped 3 per cent to $484 million or ($2.84 a share) from $498 million $2.92) on revenues of $11.7 billion compared with $10.9 billion.

The San Francisco company said the drop in second quarter and first half profits was due in part to a reduction in its equity in the earnings of its Caltex affiliate due to the rise of the Japanese yen.

Shell Oil Co., a Houston-based member of the Royal Dutch Shell Group which owns 70 per cent of Shell Oil shares, reported that its second-quarter profits increased by 2 percent to $179 million ($1.21 a share) from $175 million ($1.22) on revenues of $2.8 billion compared with $2.5 billion a year ago.

Shell's six-month profits rose to $372 million from $359 million a year ago on revenues of $5.4 billion compared with $5 billion.

Shell said the profit increase for the six months was mainly the result of higher prices for automotive gasoline and jet fuel and increased natural gas sales from new production in the Gulf of Mexico and Michigan.

Sun Co. Inc., of Philadelphia, reported an increase in its second-quarter profits to $97.3 million from $92.7 million. Revenues rose to $1.86 billion dollars from $1.53 billion.

For the first half, Sun profits declined to $173.8 million from $174.2 million. Revenues were $3.58 billion, up from $3.10 billion, Sun said.

Continental Oil Co., based in Stamford, Conn., said second quarter net earnings benefitted from improved gas and oil prices in the United States. Earnings rose nearly 32 percent to $153.8 million ($1.43 a share) up from $116.9 million ($1.09). Revenues were $2.5 billion in the quarter, up from $2.3 billion last year.

The company also has interests in coal mining and chemical production. Petroleum production earned $67.9 million, an increase of $13.9 million from last year.

Union Oil Co. of California said its earnings rose 7.4 percent in the recent quarter to $86.6 million ($1.97 a share) from $80.7 million to ($1.78) for the same period last year.

Marathon Oil said its earnings were $50.55 million ($1.68 a share), an increase of 2 percent from the $49.57 million ($1.65) per share for the same period a year ago. Second-quarter revenues amounted to $1.15 billion compared with $1.10 billion.

Bethlehem Steel Corp. reported a sharp rebound in the second quarter and attributed its earnings improvement to layoffs and plant closings last year.

The nation's No. 2 steelmaker said its second quarter profits rose to $84.8 million ($1.95 a share compared with $34.8 million (80 cents) in the same period last year. Sales rose to $1.61 billion from $1.47 billion.

"Bethleham has realized significant benefits from the actions taken last year to close marginal facilities, reduce overhead and improve efficency," said Chairman Lewis W. Foy. For the first six months, the firm earned $85.9 million ($1.97) vs. $9.6 million (22 cents).

Profits margins improved significantly in the second quarter over the first quarter," he added. At the same time, Foy reported that second quarter results included an overall loss at Bethleham's Sparrows Point shipyard in Baltimore. Bethlehem is Maryland's largest private employer.

Bethlehem has suffered a number of setbacks in the past year, including the nationwide coal strike, the severe winter, and a July 1977 flood which damaged its Johnstown, Pa., plant. Bethlehem reported a net loss of $448 million for 1977, even with an income tax credit of $436 million.

"While we may not maintain the level of profitability reported in the second quarter, we do expect to have a resonably successful second half," Foy said.

Pan American World Airways, the largest U.S. international carrier, said second-quarter profits jumped to a record $46.2 million, some three times greater than the $15.8 million in the same period last year.

The New York-based carrier said earnings in the three-month period - $1.09 a share vs. 37 cents - following a loss of $24.1 million in the first quarter, resulted from gains in passenger traffic in every area of the world it serves.

Pan Am's operating revenues for the period also set a record, increasing 15.7 percent to $553.5 million from the same period last year. Second quarter results for this year include pre-tax capital gains of $8.6 million from sales of equipment, up from $4.1 million last year.

Pan Am's earnings for the first six months were $22.1 million (52 cents a share) compared with a restated net loss of $11.1 million in the first half of last year.

General Foods Corp. a leading food manufacturer, reported higher profits for the latest quarter compared with the same period a year ago.

General Foods said profits for the first fiscal quarter, ended July 1, rose 12 per cent to a record $56. million $1.14 a share) from $50.7 million ($1.02) last year. Sales increased to $1.35 billion from $1.26 billion.