U.S. stocks rose on Friday and were set for back-to-back weekly gains as investors braced for volatility ahead of the expiration of stock options.

Basic materials stocks took the lead as Wall Street traded in a very tight range. Eastman Chemical Co gained 2.5 percent to $63 as the S&P materials index <.GSPM> moved up nearly 1 percent.

Traders are responding to the assignment and exercise of options and hedging that exposure. It makes things volatile, in a range, said Frank Lesh, futures analyst and broker at FuturePath Trading LLC in Chicago.

The Dow Jones industrial average <.DJI> gained 29.47 points, or 0.28 percent, to 10,463.64. The Standard & Poor's 500 Index <.SPX> rose 3.10 points, or 0.28 percent, to 1,119.14. The Nasdaq Composite Index <.IXIC> added 9.81 points, or 0.43 percent, to 2,316.97.

Stock options expire later Friday after index futures expired earlier in the session. The run-up to the convergence of four key expirations, known as quadruple witching, is expected to spike volatility.

The S&P 500 has held above its 200-day simple moving average since Tuesday in a bullish signal, but has found resistance near the 1,121 level, a key technical level that marks the halfway point between the October 2007 historic highs and the lows of March 2009.

CVS Caremark Corp rose 3.3 percent to $32.89 and Walgreen Co added 4 percent to $30.45 after the companies patched up their fight over reimbursements for drug prescriptions, salvaging a relationship worth billions of dollars.

BP Plc New York-traded shares rose 0.7 percent to $31.94 after its chief executive survived a bruising appearance before a U.S. congressional committee, and on hopes its $20 billion oil spill compensation and clean-up fund will cap public anger.

The euro, a yardstick used by traders to gauge risk aversion, held at three-week highs against the U.S. dollar and was on track for its second straight positive week and its strongest week in percentage gains in at least nine months.

(Editing by Jeffrey Benkoe)