The World Health Organization issued sweeping new guidelines on Wednesday that could put millions more people on H.I.V. drugs than are now getting them. The recommendations could go a long way toward halting the epidemic, health officials say, but would cost untold billions of dollars not yet committed.

H.I.V. patients should be put on an antiretroviral therapy of three drugs immediately after diagnosis, the agency said, and everyone at risk of becoming infected should be offered protective doses of similar drugs.

Immediate treatment has become the standard of care in America and much of the developed world, but the agency’s new H.I.V. treatment and prevention guidelines increase by nine million the number of infected people who should get it worldwide.

The health agency did not estimate how many at-risk people would benefit from its new prevention guidelines, but Unaids, the United Nations AIDS fighting agency, made a back-of-the-envelope calculation that 10 million could be helped, including many women and girls in Africa not previously covered.