The best treatment for a fungal nail infection is usually prescription antifungal pills taken by mouth. In severe cases, a doctor might remove the nail completely. It can take several months to a year for the infection to go away.