Stocks rose slightly on Friday, but investors stayed cautious before an long holiday weekend when hopes are set for Greece's bailout plan to be approved.

The modest advance extended Thursday's rise that has pushed the benchmark S&P index up more than 23 percent from its October low.

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.

There is a slow realization that all the negativity we saw four months ago about Europe bringing a worldwide depression .... is quickly becoming false as we look at this economic data that continues to come in pretty strong.

Typically the stock market also pauses towards 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, with 64 percent beating expectations.

The S&P 500 index has risen 8.2 percent this year.

The Dow Jones industrial average <.DJI> gained 42.92 points, or 0.33 percent, to 12,947.00. The Standard & Poor's 500 Index <.SPX> added 2.74 points, or 0.20 percent, to 1,360.78. The Nasdaq Composite Index <.IXIC> shed 8.69 points, or 0.29 percent, to 2,951.16.

Some analysts expect the market to sell into the close, as 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.

Equity markets have tended to react positively on progress in helping Athens avoid a chaotic bailout. But past agreements have broken down at the last minute and led to market disappointment.

The market is seen by chartists at a short term top, with the S&P at 9-month highs. The index came within 10 points of hitting its highest level since 2008.

The Nasdaq underperformed the overall market, dragged lower by a 14.3 percent decline in shares of Gilead Sciences to $46.99 after some patients treated with its experimental hepatitis C drug relapsed. Gilead acquired the drug with its $11 billion purchase of Pharmasset announced in November.

HJ Heinz rose 4.8 percent to $54.62 and Campbell Soup gained 2.9 percent to $33 after both food makers posted better-than-expected quarterly profits.

In contrast General Mills lost 3.9 percent to $38.21 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.

(Reporting By Chuck Mikolajczak; Editing by Kenneth Barry)