The Dow Jones Industrial Average climbed 78.07 points (0.80 percent) to 9,864.94, propelling the blue-chip index to a fresh 2009 high and its best since October 6, 2008.
The Nasdaq composite advanced 15.35 points (0.72 percent) to 2,139.28. The broad-market Standard & Poor's 500 index added 6.01 points (0.56 percent) to end at 1,071.49, a fraction shy of its 12-month high hit last month.
The market shook off early weakness, and kept moderate gains throughout the day, with sentiment helped by an improved profit outlook from oil giant Chevron and news of more corporate dealmaking.
The Dow surged nearly four percent for the week and the broad S&P index nearly 4.5 percent.
Andrea Kramer at Schaeffer's Investment Research said the market was helped by "residual earnings-related optimism" following Alcoa's surprise profit report earlier this week, raising expectations for an improving corporate profit picture.
Fred Dickson at DA Davidson & Co. said investors sitting with cash on the sidelines have been using the modest dips to buy more stocks.
"We continue to see small pullbacks followed by rallies on expanding volume, signaling equity buyers are still waiting on the sidelines to get on board the train," he said.
"Some of the recent rally can be attributed to global investors seeking to unload dollars for stocks and commodities."
The market was digesting comments from Bernanke late Thursday that rates may be lifted from the level of near zero when the US economic outlook has "improved sufficiently."
Although some analysts fear talk of a rate hike might spook the market, Robert Kavcic at BMO Capital Markets said it also meant the economy is on the mend.
"It's actually normal behavior for stocks to cheer rate hikes coming out of a recession," he said.
"For equity investors, the benefit of strengthening economic and earnings growth outweighs the cost of higher interest rates this early in the cycle."
There was little reaction to a report showing the US trade deficit narrowed for the first time in four months.
Although a lower trade gap would ordinarily be seen as positive news, analysts said it showed higher exports driven by a weak dollar and lower imports amid lackluster domestic demand.
"This month's trade report is bad news for anyone expecting to see signs of recovery in trade," said Christopher Cornell at Moody's Economy.com.
"Trade volume has flattened, both in nominal and real terms."
Among stocks in focus, Chevron rose 1.83 percent to $72.76 after it revealed interim results indicating third-quarter profits would increase on better results from exploration and production.
Kimberly Clark added 0.34 percent to $59.26 after the maker of Kleenex and other personal care products said it would buy medical equipment maker I-Flow for 276 million dollars. I-Flow rose 6.97 percent to $12.58.
Analyst upgrades helped the tech sector as IBM jumped 2.98 percent to $125.93 and Google increased 0.4 percent to 516.25.
Citigroup fell 0.43 percent to $4.63 after announcing the sale for $250 million of its oil trading unit Phibro to Occidental Petroleum, down 0.69 percent at $79.54.
Bonds fell sharply on the prospect of higher rates. The yield on the 10-year US Treasury bond rose to 3.384 percent from 3.255 percent Thursday and that on the 30-year bond climbed to 4.227 percent from 4.094 percent. Bond yields and prices move in opposite directions.