U.S. stocks closed higher Wednesday with energy leading as oil rose above $49 a barrel to hit fresh highs for the year so far.
The major averages are tracking for weekly gains of nearly 2 percent or more after posting their best day since March on Tuesday. (Tweet This)
"It has felt like the last couple of days have been a bit of a short squeeze," said JJ Kinahan, chief strategist at TD Ameritrade. He said ahead of the long weekend, traders were waiting for Fed Chair Janet Yellen's comments, expected Friday as she receives an award at Harvard.
Energy gained 1.5 percent to lead S&P 500 advancers, followed by materials and financials.
Transocean closed more than 9.5 percent higher as the top performer in the energy sector, followed by Chesapeake Energy's 7.4 percent gain and Southwestern Energy's more than 6.5 percent rise. The oil and gas drilling sub-sector closed 5.3 percent higher.
"You're going to see more of these gyrations as investors continue to weigh the Fed move," said Katie Nixon, chief investment officer at Northern Trust Wealth Management.
Overnight, St. Louis Fed President James Bullard told CNBC that a summer rate hike isn't set in stone, but the labor data is "probably the strongest argument for going ahead."
European stocks again set a positive tone for U.S. stocks, with the German DAX closing 1.5 percent higher. Euro zone finance ministers said they gave Greece a "breakthrough" debt relief deal that won provisional commitment from the International Monetary Fund.
"Yesterday the supposed catalyst was the poll in the U.K. ... Today the talk and chatter is the world economy and the world markets are pricing in and becoming comfortable with a rise in rates, either in June or July," said Peter Coleman, head trader at Convergex. "My personal opinion is it's a trading move because it's a very light volume week with not a lot of news out."
"(You've) got a lot of professional traders pushing the markets up here for a short-term trade," he said.
Lance Roberts, chief investment strategist at Clarity Financial, said the technical backdrop for stocks has improved, but "we really need to see some follow-through by the end of the week."
U.S. crude oil futures settled up 94 cents at $49.56 a barrel, its highest since October. Weekly crude inventories from the EIA showed a drawdown of 4.23 million barrels, following the American Petroleum Institute's report of a 5.1 million barrel decline. WTI last traded above $50 a barrel in mid-October.
"At the margin if you can get a few bits of good news you can get people to stop abandoning stocks," said Bruce McCain, chief investment strategist at Key Private Bank.
In economic news, the Markit Flash U.S. services PMI for May was 51.2, down from 52.8 in April and well below the long-run survey average of 55.6, Markit said.
Treasury yields were little changed, with the near 0.90 percent and the 10-year yield around 1.87 percent. Earlier, the 2-year yield touch 0.938 percent, its highest since mid-March.
The Treasury auctioned $34 billion in 5-year notes at a high yield of 1.395 percent.
The U.S. dollar index was mildly lower, with the euro near $1.115 and the yen near 110.2 yen against the greenback. Pound sterling hit $1.4728, its highest level since May 3.
Oil's gains and indications of a decreasing probability of the U.K. leaving the European Union were "what drove the sentiment change between yesterday and today," said Andres Jaime, global FX and rates strategist at Barclays.
Asian stocks closed mostly higher, although the Shanghai composite was mildly lower. China's central bank fixed the yuan at its softest midpoint against the dollar since March 2011, Reuters said.
Jaime said the "PBOC was taking this opportunity where the dollar is strong versus everything to move the fixing higher." The U.S. dollar index is on pace for a monthly gain of about 2.5 percent, its first positive month in four.
Shares of Alibaba closed 6.8 percent lower after the China-based e-commerce firm said the Securities Exchange Commission was looking into its accounting practices.
In other U.S. economic news, the advance April goods trade deficit was $57.53 billion, the U.S. Department of Commerce said.
The Federal Housing Finance Agency House Price Index rose 0.7 percent in March from the prior month.
Total mortgage application volume increased 2.3 percent for the week on a seasonally adjusted basis, a nearly 24 percent rise year-over-year, according to the Mortgage Bankers Association.
Minneapolis Fed President Neel Kashkari said in a Reuters report that negative interest rates would only be a last resort for the Fed.
Dallas Fed President Rob Kaplan suggested he sees room for fiscal policy to boost the U.S. economy, given the limitations of monetary policy, and called for "a little bit" looser regulation for small banks, according to a Reuters report.
The closed up 14.48 points, or 0.70 percent, at 2,090.54, with energy leading nine sectors higher and utilities the only decliner.
The Nasdaq composite closed up 33.84 points, or 0.70 percent, at 4,894.89.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded lower near 13.8.
About two stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 899 million and a composite volume of 3.8 billion.
Gold futures for June delivery settled down $5.40 at $1,223.80 an ounce, its lowest since early April.
—Reuters contributed to this report.
On tap this week:
Earnings: HP, NetApp, PVH, Guess, Lionsgate, Popeyes Louisiana Kitchen, Pure Storage
Earnings: Dollar General, Signet Jewelers, Abercrombie & Fitch, Chico's, Toronto-Dominion Bank, Palo Alto Networks, GameStop, Splunk
6:10 a.m. St. Louis Fed President James Bullard in Singapore
8:30 a.m. Initial claims
8:30 a.m. Durable goods
10 a.m. Pending home sales
12:15 p.m. Fed Gov. Jerome Powell
1 p.m. $28 billion seven-year note auction
Earnings: JA Solar
8:30 a.m. Real GDP Q1 (second)
10 a.m. Consumer sentiment
1:15 p.m. Fed Chair Janet Yellen receives award, in Q&A at Harvard
*Planner subject to change.