Stocks ended a volatile session slightly higher Friday, with the market managing a second consecutive week of gains as investors purchased shares after the May sell-off. For the week, the Dow industrials and the broader Standard & Poor's 500 gained over 2 percent and the Nasdaq gained over 3 percent. Worries about Europe's debt crisis and the fallout from the British Petroleum (BP) oil spill were among the factors that led to the market's sell-off. Both issues continue to influence markets, but less dramatically than they did a month ago. Gold for August delivery rose $9.60 to a record closing high of $1,258.30 an ounce after hitting an intraday record of $1,263.70 earlier in the session. Light sweet crude oil for July delivery rose 39 cents to $77.18 a barrel on the New York Mercantile Exchange. The U.S. dollar rose 0.2 percent versus the euro and fell 0.3 percent versus the yen. The Dow Jones industrial average rose 16.47, or 0.2 percent, to 10,450.64. Among the index's gainers were Boeing, Caterpillar, J.P. Morgan Chase, and Wal-Mart Stores. The S&P 500 index rose 1.47, or 0.1 percent, to 1,117.51. The technology-heavy Nasdaq composite index rose 2.64, or 0.1 percent, to 2,309.80.