LONDON, Aug 7 (Reuters) - Global stocks headed for their strongest weekly gain since May on Friday, ahead of major U.S. jobs data, as investor optimism over robust earnings growth and enthusiasm over AI offset concern about another flare-up in Middle East tensions that boosted ‌oil.

MSCI's All-World index has risen 2.3% this week, the most in three months, and on Friday was steady, while shares in drugmakers and technology ‌companies lifted Europe's STOXX 600 by 0.2% on the day and 1.6% for the week.

After bouts of volatility sparked by concerns over the durability of the AI-driven rally, investors are now squarely focused on ​the U.S. payrolls report due later in the day, which could prove crucial for the interest-rate outlook. Forecasts are centred on a rise of 80,000 jobs for July after a 57,000 gain in June, with the unemployment rate forecast to hold steady at 4.2%.

Money markets show traders are split over whether or not the Federal Reserve will raise rates next month, meaning Friday's payrolls number could be instrumental in tipping the balance in one direction or another.

"With yields and inflation still the key risks for stocks, we expect ‌Friday's NFP to trade as a 'good news is bad news' ⁠print," said Michael Feroli, chief U.S. economist at JPMorgan, adding that a strong jobs number would reinforce higher-for-longer pricing and put upward pressure on rates.

Conversely, equities may respond positively to a soft payrolls report as yields ease and policy expectations shift toward a ⁠dovish path, added Feroli.

Given Fed Chair Kevin Warsh's reluctance to offer any kind of guidance on what to expect in terms of monetary policy, the employment data could cause an even greater splash in the market than usual, analysts said.

"An exceptionally poor, or strong, print can in this way produce a much larger impact on pricings than in a time before, ​when ​the Fed was much clearer about its options. Vacuums must be filled by whatever is ​available and the market was always going to pick itself as ‌the solution, and I suspect the practical impact of that will be a broad increase in volatility," Caxton strategist David Stritch said.

On the U.S. market, Nasdaq futures rose 0.3% and S&P 500 futures were flat. Shares in Cloudflare rose 16% on the Tradegate retail platform, having surged 18% in after-hours trading on Thursday following the cloud services provider's upbeat forecast.

Tensions in the Middle East flared up again after Yemen's Iran-aligned Houthis attacked Saudi Arabia, a major oil supplier. Riyadh has warned coordinated attacks by the Houthis and Iran-backed Iraqi militias were imminent.

Brent crude futures rose 1% to $83 a barrel, but were still set for a weekly loss of 7% and ‌remained well off their recent peak of $102 a barrel two weeks ago.

Iran is reviewing a ​preliminary bill that would bar U.S., Israeli and other "hostile" vessels from transiting the Strait of Hormuz, ​Iran's semi-official Fars news agency reported on Thursday, citing a lawmaker. The draft ​bill would impose fines of up to 20% of a ship's cargo value for violations of the proposed restrictions.

Treasury yields were ‌roughly unchanged on the day, as uncertainty ahead of the jobs ​data kept trading activity subdued. The 2-year note yield ​was last at 4.243%, while the 10-year yield traded at 4.67%.

The dollar held steady, leaving the Japanese yen around 158.4. The U.S. jobs report could decide the next moves in the yen after last week's historic currency market intervention by Japan and the U.S. sparked a sharp rally.

Gold, meanwhile, has traded ​in a mirror image to the dollar, rising to its ‌highest in around six weeks this week, compared with the dollar trading around six-week lows. The gold price has risen by more than ​6% this week, its strongest such showing since mid-January, when it hit a record $5,594. It was last up 1.2% at $4,289 an ounce.

(Additional reporting ​by Stella Qiu in Sydney; Editing by Shri Navaratnam, Kate Mayberry and Susan Fenton)