Stocks added to modest gains in the last hour of trading amid rising prices for oil and gold, lifted by banks and technology.
The Dow Jones Industrial Average rose more than 35 points after falling by six points in the previous session.
Cisco , Hewlett-Packard and American Express led blue-chips higher, while Caterpillar and DuPont fell.
The S&P 500 and the tech-heavy Nasdaq traded flat. The CBOE Volatility Index, widely considered the best gauge of fear in the market, fell below 17.
Among key S&P sectors, financials and utilities rose, while materials and energy slipped.
Banks led the market higher as a new quarter got underway, and portfolio managers who had lightened positions in the first quarter moved back in, according to Scott Redler, chief strategic officer at T3live.com.
The sector was also helped by the prospect of rising rates, as well as "some clarity on the foreclosure mess," Redler says.
JPMorgan , Citigroup , and Wells Fargo were among gainers.
Technical factors continue to point to internal strength in the market, said Jack Ablin, U.S. portfolio strategist at Harris Private Bank. One of these factors is that a broad array of stocks have participated in the market's gains, even as two sectors — energy and industrials — dominated in the first quarter.
Also, Ablin points out, retail investors appear to be stepping back into the market.
"I’m getting the reading that the cash on the sidelines is filtering in," Ablin said.
High oil prices pressured stocks throughout the session, particularly shares of energy and transportation companies.
London Brent crude rose to near 2 1/2-year highs to more than $122 a barrel and U.S. light crude retreated slightly after trading above $108 a barrel. (Read More: What Would Record Oil Mean for Stocks?)
AMR , United Continental and DeltaAir , all declined sharply as oil prices rose.
Also materials stocks, led by Monsanto , began to lose ground after the fertilizer producer reported disappointing revenue results, although the firm beat earnings estimates and confirmed guidance for the year.
And stocks closely dependent on oil prices also faded, such as Eastman Chemical, Dow Chemical and DuPont .
Earlier the general tone to the market once again was positive, as the Dow edged above its high for the year.
"In light of a pretty strong economy, and a pretty strong corporate picture, there is every reason to expect that would generate momentum that would carry us to the end of the year," said Brian Gendreau, market strategist at Financial Network.
That said, Gendreau expects the market will experience a shock of one kind or another before the end of the year, and says rising oil prices will remain a concern.
Other commodities also continued to climb to new levels. Gold prices hit an all-time high of $1,460 an ounceovernight, before retreating slightly to close at $1,457.70, a new record closing high. Silver also advanced to record levels, closing at $39.38.
The dollar , meanwhile, traded flat against a basket of currencies.
The commodities surge spilled over to some stocks. Among mining stocks, Freeport McMoran Copper & Gold and Barrick Gold gained, as did silver miners Pan American Silver and Hecla Mining .