Stocks staged modest gains on Friday, lifted by supportive comments on technology bellwethers before key earnings reports due next week.

International Business Machines Corp gave the biggest boost to the Dow after Barclays boosted its price target ahead of IBM's earnings next week. The stock rose 2.3 percent to $125.06.

Barclays also upgraded the information technology hardware sector to positive from neutral, and late Thursday, Deutsche Bank predicted that semiconductor companies' quarterly results would beat expectations.

That helped lift chip makers' stocks. The Philadelphia Semiconductor index <.SOXX> gained 2.1 percent. Intel, which also reports next week, rose 1.5 percent.

Smartphone companies' shares jumped after Robert W. Baird upgraded BlackBerry maker Research in Motion to outperform, citing upcoming product launches as a potential catalyst to lift the stock.

The tech group is very well positioned as a sector, and the smartphone market is an area with explosive growth on a global basis, said Greg Woodard, portfolio strategist at Manning & Napier Advisors in Fairport, New York.

There's a lot of competition in the group, but that competition could help the sector as a whole, with companies like Microsoft , Google and Nokia benefiting in an indirect way.

RIM's U.S.-listed shares climbed 1.8 percent to $69.92 on Nasdaq.

UBS added Apple Inc , the maker of the iPhone, to its list of strategic stock picks. Apple was up 0.2 percent at $189.65.

The Dow Jones industrial average <.DJI> rose 35.37 points, or 0.36 percent, to 9,822.24. The Standard & Poor's 500 Index <.SPX> added 2.06 points, or 0.19 percent, to 1,067.54. The Nasdaq Composite Index <.IXIC> gained 9.14 points, or 0.43 percent, to 2,133.07.

Two large merger deals, which were announced on Friday, attracted investors' attention.

Kimberly-Clark Corp said it plans to acquire I-Flow Corp , a maker of drug delivery systems, for $324 million, sending I-Flow shares up 7.1 percent to $12.60 on Nasdaq. [ID:nN0947524] But Kimberly-Clark's stock dipped 0.1 percent, or 7 cents, to $58.99 on the New York Stock Exchange.

Citigroup agreed to sell its Phibro commodities trading business to Occidental Petroleum Corp .

Shares of Citi fell 0.9 percent to $4.61, while Occidental slipped 0.6 percent to $79.64, both on the NYSE.

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

The S&P 500, which has climbed nearly 60 percent from a 12-year closing low in early March, was on track at midday to reverse a two-week losing streak.

(Editing by Jan Paschal)