(AP) -- Investors remained in a buying mood Thursday, driving U.S. stocks broadly higher for the third day in a row.
The latest gains added to the market's rebound from the brief, but steep slump that followed Britain's vote to leave the European Union a week ago.
While the rally suggests that traders' anxiety over Britain's departure from the EU have eased, a surge in U.S. bond prices Thursday signaled many investors remain cautious about the possible long-term implications. As bond prices rose, the yield on the 10-year Treasury note fell to 1.47 percent.
Consumer staples companies posted the biggest gains. Utilities stocks, a traditional safe-haven for investors seeking less risk, were a close second. Oil prices fell.
"The equity market has realized that the 'Brexit' in a vacuum by itself is not a reason to wholesale abandon equities," said David Schiegoleit, managing director of investments for the private client reserve at U.S. Bank. "But there is still the fear that it becomes contagious with other economies in Europe."
The Dow Jones industrial average gained 235.31 points, or 1.3 percent, to 17,929.99. The Standard & Poor's 500 index rose 28.09 points, or 1.4 percent, to 2,098.86. The Nasdaq composite added 63.43 points, or 1.3 percent, to 4,842.67.
The stock market closed out the second quarter with modest gains.
The S&P 500 index added 1.9 percent in the April-June period. Much of the biggest gains came from energy stocks, which benefited from a rebound in oil prices, and utilities and telecom companies, which became more attractive as bond yields declined. The index is up 2.7 percent so far this year.
The Dow, which gained 1.4 percent during the second quarter, is up 2.9 percent this year. The Nasdaq lost 0.6 percent in the second quarter and is down 3.3 percent through the first half of 2016.
Trading got off to a tepid start on Thursday, but got going into rally mode by midmorning, suggesting a resolve among investors to put their worries about Britain's eventual EU exit in their rearview mirror.
Markets in Europe also extended their rebound from the two-day slump that broke on Tuesday. Britain's FTSE 100 rose 2.3 percent. The U.K.'s stock market has recouped its losses, though that is largely thanks to a drop in the British currency, which favors earnings for big companies overseas.
Germany's DAX added 0.7 percent. France's CAC 40 rose 1 percent.
The simultaneous rise in prices for stocks and U.S. bonds on Thursday was unusual and suggests nervous investors overseas are seeking the relative safety of bonds even as other traders look to ride the U.S. stock market rally further, Schiegoleit said.
"You have not only nerves pushing foreign money into U.S. Treasurys, you also have negative yields in several places around the world, which is forcing capital into the U.S. bond market," he said.
Another factor: Over 60 percent of the stocks in the S&P 500 have a dividend yield that's higher than the 10-year U.S. Treasury. That gives even income investors a reason to buy stocks because bonds yields have fallen.
The latest batch of company deal news also helped lift U.S. stocks Thursday.
Cable channel Starz climbed 6 percent after agreeing to be acquired by Lions Gate Entertainment, which owns the "Orange Is The New Black" Netflix series and the "Hunger Games" movies. Starz jumped $1.67 to $29.92. Lions Gate shed 71 cents, or 3.4 percent, to $20.23.
Hershey surged 16.8 percent following a published report that snack company Mondelez has made an overture to acquire the candy maker. Hershey said it rejected the offer. Hershey added $16.35 to $113.49. Mondelez gained $2.54, or 6 percent, to $45.51.
Care.com shares vaulted 37.9 percent after Google Capital invested $46 million in the online family care management service. Care.com added $3.21 to $11.68.
Earlier in Asia, Japan's benchmark Nikkei 225 edged up 0.1 percent, while South Korea's Kospi rose 0.7 percent. Australia's S&P/ASX 200 added 1.8 percent. Hong Kong's Hang Seng index rose 1.5.
In energy futures trading, benchmark U.S. crude fell $1.55, or 3.1 percent, to close at $48.33 a barrel in New York. Brent crude, used to price international oils, slid 93 cents, or 1.8 percent, to close at $49.68 a barrel in London. Wholesale gasoline fell 2 cents to $1.50 a gallon, while heating oil shed 5 cents to $1.48 a gallon. Natural gas rose 6 cents to $2.92 per 1,000 cubic feet.
In metals trading, gold lost $6.30 to $1,320.60 an ounce, silver gained 22 cents to $18.62 an ounce and copper added 1 cent to $2.20 a pound.
The pound slipped to $1.3244 from $1.3431, still down sharply from the pre-vote level of $1.50.
The Japanese yen, seen as a safe haven, strengthened sharply after the British referendum, but has become less volatile since then. The dollar was trading at 103.27 yen, up from 102.56 yen on Wednesday. The euro fell to $1.1077 from $1.1106.