An enlarged nonlinear model for the dynamics of HIV infection and thymic function is composed to simulate and evaluate antiretroviral therapies. In addition to the relevant biological agents, an extra state variable is included, associated with the thymus capacity for healthy cells production. The methodology contemplates eventual deleterious e¤ects of drugs over children's thymus recovery. The intake of RTI and PI drugs are modelled as two independent control variables, each a¤ecting a di¤erent term in the dynamics, so extending the prevailing pure-HAART-therapy analysis. The objective function designed here is also more inclusive than usual, accounting for the costs of the two drug families involved and for the thymus deterioration, in addition to penalizing eventual virus excess and healthy cells de…cits. The search for the best combined therapy is treated as an optimal control problem. An hybrid version of Dynamic Programming for continuous and discrete variables is used to treat the problem numerically. Long time-horizons are explored, aiming to avoid typical peaks in drug prescriptions found at the beginning and end of the optimization periods. Results indicate that certain combinations of drugs are more convenient than pure protocols when the value of thymus functioning is relevant, specially for children patients.