Biotech stocks recovered from recent losses, with the iShares Nasdaq Biotech ETF (IBB) up 0.75 percent to boost the Nasdaq.
The Dow transports jumped nearly 1.5 percent as nearly all constituents advanced.
Precision Castparts surged 19 percent on news that Warren Buffett's Berkshire Hathaway will acquire the maker of aircraft equipment for $235 a share, making for an all-cash deal of about $37.2 billion.
IBM gained more than 1 percent after Buffett said on CNBC that "he loves it" when IBM's stock price goes down because the company can repurchase shares at better prices. Buffett's Berkshire Hathaway has an 8.12 percent stake in IBM, according to recent filings. The stock is off 3 percent for the quarter so far.
"Warren Buffet's deal reminds there's value to things in the manufacturing sector," said James Meyer, chief investment officer at Tower Bridge Advisors.
Investors also focused on remarks by Federal Reserve members for further indications on the timing of a rate hike.
Economic conditions in the United States have largely returned to normal and a Federal Reserve decision to raise interest rates should come soon, the Atlanta Fed's Dennis Lockhart said in a Reuters report Monday.
He added in comment to journalists that he was "disposed" to begin raising rates in September but expected a gap of at least one policy meeting before any subsequent increases, Reuters reported.
"I think the point of 'liftoff' is close," Lockhart said in prepared remarks for an address to the Atlanta Press Club. "The economy has made great gains and is approaching an acceptable normal ... conditions are no longer extraordinary."
Last week, Lockhart moved markets when he said in his view he saw no reason to hold off on a September rate hike.
"We think that it's probably not going to have as negative an impact," said Mario Minotti, president of Minotti Group.
Stocks closed lower on Friday amid a decline in oil and July's nonfarm payrolls report that continued to show modest improvement in the labor market.
On the inflation front, Federal Reserve Vice Chairman Stanley Fischer said earlier on Bloomberg TV that U.S. inflation is "very low" but only temporarily so, and the economy has nearly achieved full employment.
"I think we might be in a rebound rally today thanks to Greece nearing a deal, M&A and Fischer," said Peter Cardillo, chief market economist at Rockwell Global Capital.
The U.S. dollar traded about half a percent lower, with the euro climbing above $1.10 for the first time in more than a week.
The 10-year Treasury yield gained to 2.23 percent, with the 2-year yield trading flat near 0.73 percent.
European stocks closed higher amid U.S. gains on oil's recovery. The ATHEX Composite ended up 2 percent.
Earlier, hopes of a Greece deal helped European equities turn higher and U.S. stock index futures extend gains. As soon as a bailout deal is agreed, Greek banks could receive an initial injection of as much as 10 billion euros, a euro zone official familiar with the situation told Reuters. The payout could come even before the European Central Bank completes a stress test, the report said.
Athens faces a repayment deadline to the European Central Bank on Aug. 20. The cash-strapped government and its creditors are in talks—which could conclude on Tuesday—for about 86 billion euros ($94 billion) in fresh loans.
However, the International Monetary Fund said Greece needs a third bailout worth around 90 billion euros ($98.9 billion), Reuters reported, citing Germany's Handelsblatt.
As earnings season winds down, reports from Credicorp, Kraft Heinz, Rackspace, and Shake Shack are all due after the bell.
In other corporate news, Alibaba jumped about 2.1 percent on its announcement of a 19.99 percent stake of 28.3 billion yuan ($4.56 billion) in Chinese electronics retailer Suning Commerce Group.
Twitter surged more than 9 percent amid a deal with the National Football League and news that interim CEO Jack Dorsey and other insiders bought shares of the beaten-down stock.
Read MoreEarly movers: PCP, IBM, BABA, TWTR, AZN, FCX, DF & more
The Dow Jones Industrial Average closed up 241.79 points, or 1.39 percent, at 17,615.17, with Caterpillar leading advancers and Coca-Cola the only decliner.
The S&P 500 closed up 26.61 points, or 1.28 percent, at 2,104.18, with energy leading nine sectors higher and utilities the only laggard.
The Nasdaq closed up 58.25 points, or 1.16 percent, at 5,101.80.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded near 12.
About three stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 807 million and a composite volume of nearly 3.4 billion in the close.
Gold futures settled up $10.00 at $1,104.10 an ounce, their highest level since June 21.
—Reuters contributed to this report.
On tap this week:
Earnings: Kraft Heinz, Live Nation Entertainment, Mindray Medical International, Rackspace, Shake Shack, Take Two Interactive, Hertz
Earnings: Cree, Computer Sciences, Symantec, Towers Watson, Red Robin Gourmet Burgers, Cyber Ark Software, JA Solar, Silver Wheaton
7:30 a.m.: NFIB small business survey
8:30 a.m.: Productivity and costs
10 a.m.: Wholesale trade
1 p.m.: $24 billion 3-year auction
Earnings: Cisco, Macy's, News Corp., Alibaba, NetEase, Markit, Wayfair
8:30 a.m.: New York Fed President William Dudley
10 a.m.: JOLTs
1 p.m.: $24 billion 10-year auction
2 p.m.: Federal budget
Earnings: Nestle, Kohl's, Nordstrom, Applied Materials, Flowers Foods, El Pollo Loco, King Digital, Party City
8:30 a.m.: Initial claims, retail sales, import prices
10 a.m.: Business inventories
1 p.m.: $16 billion 30-year auction
8:30 a.m.: PPI
9:15 a.m.: Industrial production
10 a.m.: Consumer sentiment
More From CNBC.com: