Gold inched lower on Friday as the dollar recovered, though prices held near a three-week high and were on track for a second straight weekly rise.

Often perceived as an insurance against risk, Gold has risen nearly 2 percent this week after weaker than expected US payrolls data dented expectations of an imminent rise in US interest rates, though that view was tempered by Thursday's surprise drop in weekly US jobless claims. Prices are likely to be bolstered in the next two weeks by nervousness over Britain's June 23 referendum on its EU membership, analysts said.

 "The market is no longer worried that the Fed will raise rates next week and investors are more concerned about the UK referendum, which is likely to help increase demand for gold," Danske Bank senior analyst Jens Pedersen said. Spot gold was down only 0.1 percent at $1,268.10 an ounce by 1015 GMT, still close to its highest since May 18, the $1,271.31 hit in the previous session. Spot silver touched a three-week high earlier in the session and was on track for its biggest weekly gain since the end of April. Though it slipped 0.3 percent to $17.21 an ounce, the metal has risen about 5 pct this week. "Last week's unexpectedly weak US jobs data and subsequent cautious tone by (Fed chair Janet) Yellen opened the door for gold to resume its bull cycle," ANZ analyst Daniel Hynes said.

"Investor demand is expected to remain strong in the short term, driven by easing expectations of a rate hike in the United States." Gold is highly sensitive to rising interest rates, which lift the opportunity cost of holding non-yielding bullion while boosting the dollar, in which it is priced. "UK and German sovereign debt yields fell to record lows, helping to fuel gold's rally," HSBC said in a note.

"Safe-haven and hedge-related buying ahead of the UK referendum on continued EU membership is becoming more noticeable, with a portion of this demand being funnelled into physical gold purchases." Holdings in SPDR Gold Trust, the world's largest gold-backed exchange-traded fund, rose 0.71 percent to 887.38 tonnes on Thursday, the highest since October 2013. Among other precious metals, platinum fell 0.5 percent to $990.25 and palladium was down 1.4 percent at $550.29.