"Improved sentiment in Europe is providing a boost to U.S. equities," said John Lonski, chief economist at Moody's.
European stocks opened higher and rallied on initially encouraging reports out of Greece. The German DAX closed up more than 1 percent, while Greece's ATHEX Composite ended 3.5 percent higher.
"That would lessen the perceived risk surrounding the Greek's ability to make good on its debt payment obligations," Lonski said.
News out of the ongoing debt talks were mixed. Greek Prime Minister Alexis Tsipras said on Wednesday the negotiations are on the "final stretch" towards a positive deal, Reuters reported. A European official said in a Bloomberg report that "we are still working toward an agreement" and that no accord was reached.
Separately, the European Central Bank left the ceiling on emergency funding for Greek banks unchanged for the first time since February, Reuters said.
Later in the day, German Finance Minister Wolfgang Schaeuble said there was not much progress in the Greek debt talks and he was surprised by the upbeat tone from some Greek government officials, according to an ARD television interview cited by Reuters.
The dollar gave back early gains to trade mildly higher, with the euro trading near $1.09. The yen remained near 8-year highs against the greenback.
Read MoreThe most important sign a dollar breakout is coming
Marc Chandler, foreign exchange strategist at Brown Brothers Harriman, said the dollar moved on Greek headlines but he is still suspicious that much progress was made.
Athens must make a 300 million euro payment to the International Monetary Fund on June 5, ahead of several other payments due to the IMF later in the month, for a total of 1.6 billion euros.
Treasury yields pared gains in late trade, with the 2-year at 0.65 percent after rising as high as 0.67 percent. The 10-year yield was 2.13 after touching 2.17 percent. The Treasury Department auctioned $35 billion of 5-year notes at a high yield of 1.560 percent, the highest year-to-date.
"I think the market is going to catch its breath after yesterday's tumble. The focus remains on the dollar and the yield curve," said Peter Cardillo, chief market economist at Rockwell Global Capital.
No major data was expected Wednesday. Weekly mortgage applications dropped 1.6 percent as higher rates put a pause on refinancing.
Investors kept an eye on the Dow transports, which recovered to close up 1.1 percent. On Tuesday, the index extended its recent selloff with its 50-day moving average falling below its 200-day moving average.
Read MoreDollar and bond yields to dominate trading
'There's "nothing that suggests a correction in the transports is over and eventually the broader market will get hit," Cardillo said. " I think June is going to be a bit different from May—a tough month for stocks."
The CBOE Volatility Index (.VIX), considered the best gauge of fear in the market, fell to trade near 13. The index jumped 16.2 percent on Tuesday for its best daily move since January 28.
"The VIX was near year-to-date lows. When that happens, it becomes very skittish and very sensitive to any negative move," said Randy Frederick, managing director of trading and derivatives at Charles Schwab.
Stocks closed down more than 1 percent on Tuesday as investors weighed a strong dollar and mixed economic data that indicated the Fed could tighten sooner rather than later.
"This is the least-trusted bull market. At the first sign of weakness you see lots of people exit," said Adam Sarhan, CEO of Sarhan Capital.
"If we open higher and close lower, that may be a subtle indication that the market isn't ready to go higher," he said.
U.S. Treasury Secretary Jack Lew attends the G7 meeting of finance ministers in Dresden on Thursday and Friday.
Ahead of the meeting, Lew told students at the London School of Economics that European negotiators must not miscalculate as they try to negotiate a debt deal with Greece's government given uncertainty over the actual cost of a Greek exit from the euro zone.
U.S. Federal Reserve Vice Chairman Stanley Fischer said Tuesday that markets should not be surprised by the timing or pace of rate hikes.