Stocks rose slightly on Friday, extending their four-day winning streak as investors anticipated some positive news out of next week's key earnings reports, while bullish broker comments gave a boost to tech shares.

International Business Machines Corp , rose 2.7 percent to $125.61, leading the Dow higher after Barclays Capital raised its price target to $140 from $119, and upgraded the information technology hardware sector to positive from neutral.

Separately, Deutsche Bank predicted late Thursday that semiconductor companies would report upside surprises in their earnings for the past three months.

The Philadelphia Semiconductor index <.SOXX> climbed 2.7 percent, while another Dow component Intel rose 1.6 percent to $20.20.

Both IBM and Intel are scheduled to report quarterly results next week.

Hewlett-Packard Co also gained, adding 1.8 percent to $47.30.

At this point, investors are staying back to watch how next week will turn out, said Fred Dickson, market strategist at D.A. Davidson & Co in Lake Oswego, Oregon.

The mood is ... reasonably optimistic (on earnings) which is part of the reason why we have seen 3-4 percent gains so far this week.

The Dow Jones industrial average <.DJI> was last up 41.94 points, or 0.43 percent, to 9,828.81. The Standard & Poor's 500 Index <.SPX> edged up 1.91 points, or 0.18 percent, to 1,067.39. The Nasdaq Composite Index <.IXIC> added 7.63 points, or 0.36 percent, to 2,131.56.

Research in Motion also lifted tech shares after Robert W. Baird upgraded the stock to outperform on upcoming product launches. The stock rose 0.7 percent to $69.17.

Two large merger deals attracted investor attention on Friday.

Kimberly-Clark said it plans to acquire I-Flow Corp , for $324 million, sending I-Flow shares up 7 percent to $12.57. But Kimberly-Clark was down 0.08 percent at $59.01.

Citigroup agreed to sell its Phibro commodities trading business to Occidental Petroleum Corp . Citi's shares fell 1.1 percent to $4.60 while Occidental's stock was down 1.1 percent at $79.20.

According to the Commerce Department, the U.S. trade deficit unexpectedly narrowed in August, as trade in services pushed exports slightly higher and imports fell by a fractionally larger amount.

Stocks briefly dipped at the open on Friday, pressured by a rebounding U.S. dollar after Fed Chairman Bernanke said the Fed will eventually have to start tightening its monetary policy as the economy heals.

The S&P 500, which has climbed nearly 60 percent from a 12-year closing low in early March, was on track to reverse a two-week losing streak, and headed for its best weekly gains since July.