NEW YORK (AP) --- U.S. stocks continued to climb Wednesday, led by technology, health care and energy companies. Media companies also rose as stock indexes set record highs.
The technology part of the Standard & Poor's 500 index finally broke the record it set in March 2000, before the dot-com bubble burst. Energy companies rose with the price of oil as U.S. energy stockpiles continued to shrink. Cable network companies Scripps Networks and Discovery Communications jumped after the Wall Street Journal reported that they are in talks to combine.
Stocks have been setting records for most of this year, and over the last few months they've gotten a boost from a recovery in corporate profits.
"Earnings are coming in better than expected so far," said Jon Adams, senior investment strategist for BMO Global Asset Management. "Technology in particular has come in very strong."
The Standard & Poor's 500 index rose 13.22 points, or 0.5 percent, to 2,473.83. Despite a sharp drop from IBM, the Dow Jones industrial average added 66.02 points, or 0.3 percent, to 21,640.75. The Nasdaq composite gained 40.74 points, or 0.6 percent, to 6,385.04. The Russell 2000 index of smaller-company stocks jumped 14.16 points, or 1 percent, to 1,441.77. All four indexes closed at record highs.
The S&P 500 technology index finally surpassed its peak from late March 2000, at the height of the dot-com boom. That index came close to an all-time high in early June, but after that technology companies went into a swoon that lasted about a month. Their recovery over the last two weeks has helped the Nasdaq composite pull off a rally as well.
Apple picked up 94 cents to $151.02 and Facebook advanced $1.28 to $164.14 while Cisco Systems rose 39 cents, or 1.2 percent, to $31.90.
Vertex Pharmaceuticals climbed after it reported strong results from studies of drug regimens that are intended to help hard-to-treat forms of cystic fibrosis. Vertex soared $27.53, or 20.8 percent, to $159.69. That followed a 2.3 percent gain Tuesday after regulators approved a breast cancer treatment the company developed. Vertex's stock has more than doubled this year and it is trading at all-time highs.
Other health care companies also traded higher, including health insurers. Cigna picked up $2.21, or 1.3 percent, to $174.31 and UnitedHealth added $2.34, or 1.3 percent, to $189.19. Those companies mostly fell Tuesday after the Republican-backed health care bill failed in the Senate.
Oil prices rose after the U.S. government said fuel stockpiles shrank last week. Benchmark U.S. crude rose 72 cents, or 1.6 percent, to $47.12 a barrel in New York. Brent crude, the standard for international oil prices, gained 86 cents, or 1.7 percent, to $49.70 per barrel in London. Oil prices have mostly stayed between $40 and $55 a barrel since mid-February of 2016 after they plunged from more than $100 a barrel in mid-2014.
Scripps Networks and Discovery Communications jumped after the Wall Street Journal reported that the two cable network companies are in talks to combine. Scripps, which owns HGTV, Food Network and Travel Channel, climbed $9.87, or 14.7 percent, to $76.89. Discovery Communications, which runs TLC and Animal Planet, gained $1.13, or 4.3 percent, to $27.18.
Homebuilders jumped after the Commerce Department said construction of new homes rose 8 percent in June, breaking a three-month losing streak. Home construction is up slightly this year, but not enough to make up for a decline in in older homes being listed for sale.
Spice maker McCormick agreed to buy RB Foods, the food division of Reckitt Benckiser, for $4.2 billion. That will give the company brands including French's mustard and Frank's RedHot. The price was higher than some analysts expected, and McCormick lost $5.07, or 5.2 percent, to $92.07.
Other food companies traded higher. Campbell Soup rose $1.58, or 3.1 percent, to $52.57 and Chef Boyardee maker Conagra Brands added 53 cents, or 1.6 percent, to $33.85.
IBM posted weaker sales than analysts expected, and its stock dropped $6.47, or 4.2 percent, to $147.53.
Morgan Stanley climbed after the investment bank said its trading businesses did well during the second quarter, a contrast to rival banks which reported poor trading results as market conditions were quiet last quarter. Morgan Stanley rose $1.48, or 3.3 percent, to $46.62.
In other energy trading, wholesale gasoline rose 4 cents to $1.62 a gallon. Heating oil gained 4 cents to $1.55 a gallon. Natural gas lost 2 cents to $3.07 per 1,000 cubic feet.
Gold inched up 10 cents to $1,242 an ounce. Silver rose 3 cents to $16.30 an ounce. Copper lost 2 cents to $2.71 a pound.
Bond prices inched lower. The yield on the 10-year Treasury note rose to 2.27 percent from 2.26 percent.
The dollar dipped to 111.78 yen from 111.98 yen. The euro fell to $1.1517 from $1.1563.
The CAC 40 of France rose 0.8 percent and the British FTSE 100 jumped 0.6 percent. Germany's DAX added 0.2 percent. Japan's Nikkei 225 stock index edged up 0.1 percent and the Hang Seng in Hong Kong climbed 0.6 percent. The South Korean Kospi added 0.2 percent.