Gold futures edged lower on Friday but managed to close the week with a gain of almost 4 percent as oil prices continued to soar and weakness in the U.S. dollar boosted the demand for a hedge against inflation.

Gold for August delivery closed at $903.70 an ounce on the New York Mercantile Exchange, down 50 cents for the session. The precious metal closed last Friday at $873.10, make a gain of 3.5 percent for the week.

Crude oil rose as the weaker dollar enhanced the appeal of commodities as a currency hedge and the New York Times reported that Israel held a rehearsal for a potential bombing attack on nuclear targets in Iran. Crude oil for July delivery rose $2.69, or 2 percent, to settle at $134.62 a barrel at 2:48 p.m. on the New York Mercantile Exchange.

The U.S. dollar fell against other major currencies, with the dollar index dropping 0.6 percent to 73.037. Weakness in the greenback typically boosts dollar-denominated commodities, including gold and oil.

July silver gave back 7.3 cents to close at $17.397 an ounce, but the contract was still 5 percent higher for the week.

September palladium closed flat at $479.20 an ounce, 1 percent higher for the week. July platinum gained $6.60 to finish at $2,062.40 an ounce, up 1.3 percent for the week. July copper futures rose 5.3 cents to close at $3.832 a pound, up 6.8 percent for the week.