SAN FRANCISCO -- The Bill and Melinda Gates Foundation, the world's largest private philanthropy fund, sold off almost all of its pharmaceutical, biotechnology and health-care investments in the quarter ended June 30, according to a regulatory filing published Friday.

The Seattle-based charity endowment, set up by Microsoft Corp. founder Bill Gates and his wife, sold its total holding of 2.5 million shares in health-care giant Johnson & Johnson in the quarter, according to the filing.

The...