In AIDS studies such as HIV viral dynamics, statistical inference is often complicated because the viral load measurements may be subject to left censoring due to a detection limit and time-varying covariates such as CD4 counts may be measured with substantial errors. Mixed-effects models are often used to model the response and the covariate processes in these studies. We propose a unified approach which addresses the censoring and measurement errors simultaneously. We estimate the model parameters by a Monte-Carlo EM algorithm via the Gibbs sampler. A simulation study is conducted to compare the proposed method with the usual two-step method and a naive method. We find that the proposed method produces approximately unbiased estimates with more reliable standard errors. A real data set from an AIDS study is analysed using the proposed method. Copyright © 2004 John Wiley & Sons, Ltd.