The immune response to Mycobacterium tuberculosis (Mtb) infection is complex. Experimental evidence has revealed that tumor necrosis factor (TNF) plays a major role in host defense against Mtb in both active and latent phases of infection. TNF-neutralizing drugs used to treat inflammatory disorders have been reported to increase the risk of tuberculosis (TB), in accordance with animal studies. The present study takes a computational approach toward characterizing the role of TNF in protection against the tubercle bacillus in both active and latent infection. We extend our previous mathematical models to investigate the roles and production of soluble (sTNF) and transmembrane TNF (tmTNF). We analyze effects of anti-TNF therapy in virtual clinical trials (VCTs) by simulating two of the most commonly used therapies, anti-TNF antibody and TNF receptor fusion, predicting mechanisms that explain observed differences in TB reactivation rates. The major findings from this study are that bioavailability of TNF following anti-TNF therapy is the primary factor for causing reactivation of latent infection and that sTNF--even at very low levels--is essential for control of infection. Using a mathematical model, it is possible to distinguish mechanisms of action of the anti-TNF treatments and gain insights into the role of TNF in TB control and pathology. Our study suggests that a TNF-modulating agent could be developed that could balance the requirement for reduction of inflammation with the necessity to maintain resistance to infection and microbial diseases. Alternatively, the dose and timing of anti-TNF therapy could be modified. Anti-TNF therapy will likely lead to numerous incidents of primary TB if used in areas where exposure is likely.