A new approach for inferring the evolutionary process of within-host virus is presented in this study. This approach includes a sequential-linking algorithm developed by us that can deal with the sequential viral samples that are obtained at different time points from the same host, and reconstruct a longitudinal phylogenetic tree in which the evolutionary relations between viral variants can be shown. A codon-based model, which uses a Markov process to describe substitutions between codons, is also employed in this approach to calculate synonymous and nonsynonymous substitution rates and to distinguish positive selection and neutral evolution. The approach is applied to a data set of the V3 region of the HIV-1 envelope genes sequenced in different years after infection of a single patient. The results suggest that this approach may provide a more realistic description of viral evolution than the traditional evolution models because it accounts for both neutral and adaptive evolution. Most important of all, since this approach make it possible to follow up the evolutionary process of within-host virus by analyzing the sequential viral samples, it could be used in inference and prediction of the course of the diseases caused by pathologic viruses and evaluation of the treatment.