U.S. stocks edged higher on Friday, but investors stayed cautious before a long holiday weekend when hopes are set for Greece's bailout plan to be approved.
The S&P ended its sixth positive week out of seven so far in 2012, lifting it near levels not seen in more than three years. The index has risen 8.2 percent so far this year.
Friday's modest advance has pushed the benchmark index up nearly 24 percent from its October low. European shares ended the week higher ahead of the deal, with the FTSEurofirst 300 index up 0.6 percent.
Euro-zone finance ministers will meet to approve a 130 billion euro rescue package for Greece on Monday when the U.S. market will be closed for the Presidents Day holiday.
"The fact the European market is up the Friday before, knowing the U.S. market is off on Monday, is really a sign that the Greece situation is priced into the market," said Andrew Slimmon, managing director of Global Investment Solutions at Morgan Stanley Smith Barney in Chicago.
Analysts were wary of a pullback after Thursday's strong gains pushed the S&P to its highest since May 2 and viewed the market's resilience as constructive.
"It is encouraging that we obviously had some breakouts yesterday on the indexes and we are not giving anything back," said Ryan Detrick, senior technical strategist at Schaeffer's Investment Research in Cincinnati.
Technicians see the market at a short-term top, with the S&P at nine-month highs and within 10 points of hitting its highest level since 2008.
The Dow Jones industrial average gained 45.56 points, or 0.35 percent, to 12,949.64. The Standard & Poor's 500 Index added 3.17 points, or 0.23 percent, to 1,361.21. The Nasdaq Composite Index dropped 8.07 points, or 0.27 percent, to 2,951.78.
For the week, the Dow rose 1.2 percent, the S&P gained 1.4 percent and the Nasdaq advanced 1.7 percent.
Equity markets have tended to react positively on progress toward helping Greece avert a disorderly default, but past agreements have broken down at the last minute.
Wall Street stocks also typically pause near the end of earnings season as the market digests the results. According to Thomson Reuters data, 404 of the S&P 500 companies have reported results through Friday, with 64 percent beating expectations.
The Nasdaq underperformed the overall market, dragged lower by a 14.3 percent decline in shares of Gilead Sciences to $47. The drop came after some patients treated with its experimental hepatitis C drug relapsed.
HJ Heinz rose 4.5 percent to $54.47 and Campbell Soup gained 2.6 percent to $32.90 after both food makers posted better-than-expected quarterly profits.
In contrast General Mills lost 3.6 percent to $38.34 after it lowered its outlook.
Data showed U.S. gasoline prices jumped 0.9 percent in January, pushing overall consumer prices up and offering a reminder of the risks energy costs pose to the economic recovery.
Volume was modest with about 6.5 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, below the daily average of 6.98 billion.
Advancing stocks outnumbered declining ones on the NYSE by 1,695 to 1,261, while on the Nasdaq, advancers beat decliners 1,266 to 1,235.