Doctors may recommend using boric acid for a yeast infection as a second-line treatment when other antifungal medications are not working. Boric acid works by preventing Candida fungi from growing.