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 .
On the tech front, Cisco shares climbed a day after CEO John Chambers sent an internal memo defending the networking company's strategy while acknowledging it has flaws in "operational execution" and a loss of accountability.
While flawed, investors view Cisco's stock as still having value. It seems to be “quite inexpensive” and relative to its peers, it remains “very attractive,” Simon Leopold, analyst at Morgan Keegan said on CNBC.
“The expectation that the company has lost overall market share is a tremendous exaggeration and this is presenting to investors an opportunity for investment—[although] it’s not necessarily a short-term trade,” Leopold added.
Also, most semiconductor stocks continued to rise in the wake of Texas Instrument's $6.5 billion all-cash bid for National Semiconductor .
The iShares PHLX SOX Semiconductor Sector Index Fund rose another 1 percent after advancing on Tuesday. Advanced Microdevices and Micron were among the gainers.
Broadcom soared after Oppenheimer upgraded the communications semiconductor provider to "outperform" from "perform," citing the growth in wireless markets and networking.
Meanwhile, American Superconductor plunged more than 40 percent after the wind-turbine gear maker warned it expects to post a quarterly loss and cut its revenue view sharply.
In M&A news, Smithfield Foods sank after the pork producer confirmed it is in talks to acquire a majority stakein European meat producer Campofrio Food.
NYSE Euronext'sboard of directors plans to meet by April 14 to consider Nasdaq OMX Group's unsolicited takeover bid, though no firm date has been set, a person familiar with the plan told Reuters Tuesday. A NYSE spokesman told CNBC that the Nasdaq counteroffer: "Is not an alternative we are considering, period." Gains in the Nasdaq led the financials sector.
Retail stocks will be in the spotlight when monthly same-store sales are released on Thursday. According to a report, consumers are still spending, but at a slower rate than a year ago, because Easter is late this year and consumers are beginning to worry about rising gas prices.
One retailer on the rise is Abercrombie & Fitch , which received price target upgrades from several brokerages after the clothing chain forecast strong profits next year at an analyst meeting a day earlier. Rivals Aeropostale , Delia's and Urban Outfitters also gained.
Bed, Bath & Beyond is expected to report earnings after-the-bell.
Dish Network shares rose slightly after the satellite TV provider won Blockbuster in a bankruptcy auctionfor about $320 million.
In economic news, the Mortgage Bankers Association'sweekly gauge of mortgage loan activity dropped 2 percent in the week ended April 1, led by refinancing applications, which fell 6.2 percent.
Meanwhile, Atlanta Fed President Dennis Lockhart said the economy remains too fragile to begin raising rates. Lockhart also said the central bank had no compelling reason to shift course on its $600 billion bond buying program. Some members have hinted that the Fed could cut the program short.
On Tuesday, the Fed released minutes of its last policy setting meeting that showed Fed members are divided on the need for further stimulus and future interest rate increases.
In the U.S., Congress faces a Friday deadline to approve a spending bill. Negotiations continued Wednesday.
In Europe, Portugal said Wednesday that it will need help after allfrom the European Union, but it remains unclear whether the nation is seeking a short-term loan or bailout similar to one received by Greece. The nation has struggled with worsening finances. Last month, Prime Minister Jose Socrates resigned when the parliament failed to pass austerity measures he backed.
"In this difficult situation, which could have been avoided, I understand that it is necessary to resort to the financing mechanisms available within the European framework," Finance Minister Fernando Teixeira dos Santos said, according to Reuters. Earlier, Portugal had to pay a high priced to raise 1 billion euros in a short-term debt.
European stocks closed higher, adding to their three-week rally.
On Tap This Week:
THURSDAY: Monthly chain-store sales, Bank of England Announcement, European Central Bank announcement, jobless claims, consumer credit, money supply; Lacker speaks; earnings from Constellation Brands before-the-bell and Rite Aid after-the-bell.
FRIDAY: Wholesale trade.
More on CNBC.com