NEW YORK (AP) -- U.S. stocks broke a two-day losing streak Wednesday as investors bought up drugmakers and other health care companies. Energy companies also jumped as the price of oil surged.
Biotech drug companies, which have been mired in a long slide, made their biggest gains in almost five years. That came after Pfizer, one of the largest pharmaceutical companies in the world, gave up on a plan to buy Botox maker Allergan for $160 billion and investors wondered if it will look elsewhere.
The gains were only enough to wipe out most of the market's losses from a day earlier. Stocks wavered in recent weeks as investors wait for quarterly earnings to start pouring in, and many are bracing for another shaky quarter.
Jack Ablin, chief investment officer of BMO Private Bank, said it's going to be another weak earnings period, and the only way stocks will trade much higher is if companies are able to give optimistic projections for the rest of the year.
"Without an improvement in earnings or a projection of earnings growth, our outlook is kind of tapped out," he said.
The Dow Jones industrial average gained 112.73 points, or 0.6 percent, to 17,716.05. The Standard & Poor's 500 index rose 21.49 points, or 1.1 percent, to 2,066.66. The Nasdaq composite index picked up 76.78 points, or 1.6 percent, to 4,902.72.
Pfizer and Allergan confirmed Wednesday that they are walking away from their proposed merger after the U.S. Treasury Department announced new rules that made the deal, and others like it, far less appealing. Pfizer rose $1.57, or 5 percent, to $32.93, its biggest gain since 2011.
Pfizer was ready to make one of the largest corporate deals in history for Allergan as it tried to boost its sales and cut its tax bill. Biotechnology companies, which make complex and costly drugs, climbed higher. Celgene, which makes treatments for cancer, gained $6.10, or 6 percent, to $108.22. Vertex Pharmaceuticals rose $7.15, or 8.5 percent, to $91.31.
Biotech stocks are facing pressure from legislators over the price of their drugs, and investors fear that their ability to raise prices will be impeded.
Energy companies gained ground as benchmark U.S. crude rose $1.86, or 5.2 percent, to close at $37.75 a barrel in New York. Brent crude, a benchmark for international oils, added $1.97, or 5.2 percent, to close at $39.84 a barrel in London. The price of oil has skidded in recent days before making small gains Tuesday.
Chevron picked up $2.17, or 2.3 percent, to $94.84 and Exxon Mobil added $1.10, or 1.3 percent, to $83.31. Hess rose $2.74, or 5.3 percent, to $54.
Oilfield services companies Halliburton and Baker Hughes also traded higher after the U.S. government sued to block them from combining. Halliburton had agreed to buy its rival for more than $34 billion in November 2014, after oil prices began to fall. Baker Hughes gained $3.47, or 8.8 percent, to $42.83. Halliburton climbed $2.04, or 5.9 percent, to $36.44.
While the pace of company earnings will climb next week, a few companies made big moves Wednesday after they disclosed their results. Constellation Brands, the owner of Corona, Negra Modelo and Pacifico beers, reported solid quarterly results and raised its profit forecasts for the year. Its stock rose $8.98, or 5.9 percent, to $160.34.
Electronic payment processing company Global Payments gained $5.71, or 8.8 percent, to $70.86 after it posted strong quarterly results.
Lighting maker Cree said its sales will fall far short of expectations because of new product delays and software problems. The company said it may take a loss in the third quarter. Its stock lost $4.24, or 14.6 percent, to $24.81.
Ablin of BMO Private Bank said he thinks companies with a long history of maintaining or raising their dividends will do the best in the weeks and months to come. Telecommunications companies pay some of the biggest dividends on the market, and they slumped Wednesday as AT&T and Verizon prepared to pay out billions of dollars in dividends.
Harley-Davidson took the biggest loss on the S&P 500, as it gave up $3.50, or 7 percent, to $46.34. Analyst John Tomlinson of ITG Investment Research said he thinks the motorcycle company lost market share over the first three months of this year, and said he thinks its retail sales in the U.S. will drop in the first quarter.
In metals trading, the price of gold fell $5.80 to $1,223.80 an ounce. Silver declined six cents to $15.05 an ounce. Copper inched up less than one cent to $2.14 a pound.
In other energy trading, wholesale gasoline rose two cents to $1.39 a gallon. Heating oil jumped almost seven cents to $1.14 a gallon. Natural gas fell four cents to $1.91 per 1,000 cubic feet.
Stocks in Europe also gained ground. Britain's FTSE 100 rose 1.2 percent and the CAC 40 in France added 0.8 percent. Germany's DAX rose 0.6 percent. Japan's Nikkei 225 closed 0.1 percent lower and the Hang Seng index in Hong Kong picked up 0.2 percent. South Korea's KOSPI finished 0.4 percent higher.
Bond prices fell. The yield on the 10-year U.S. Treasury note rose to 1.76 percent from 1.72 percent. The U.S. dollar dipped to 109.62 yen from 110.49 yen. The euro rose to $1.1410 from $1.1385.