This paper studies optimal portfolio selection problems in the presence of stochastic volatility and stochastic interest rate under the mean-variance criterion. The financial market consists of a risk-free asset (cash), a zero-coupon bond (roll-over bond), and a risky asset (stock). Specifically, we assume that the interest rate follows the Vasicek model, and the risky asset’s return rate not only depends on a Cox-Ingersoll-Ross (CIR) process but also has stochastic covariance with the interest rate, which embraces the family of the state-of-the-art 4/2 stochastic volatility models as an exceptional case. By adopting a backward stochastic differential equation (BSDE) approach and solving two related BSDEs, we derive, in closed form, the static optimal (time-inconsistent) strategy and optimal value function. Given the time inconsistency of the mean-variance criterion, a dynamic formulation of the problem is further investigated and the explicit expression for the dynamic optimal (time-consistent) strategy is derived. In addition, analytical solutions to some special cases of our model are provided. Finally, the impact of the model parameters on the efficient frontier and the behavior of the static and dynamic optimal asset allocations is illustrated with numerical examples.