In this paper, we propose an efficient control scheme for active queue management (AQM) supporting TCP flows. The proposed controller consists of two parts: a rate controller and a queue size controller. The rate controller is a proportional-integral (PI) controller, which improves the response to dynamic traffic variation and keeps the packet arrival rate around the link capacity. The queue size controller is a proportional (P) controller like the Random Early Detection (RED) algorithm. The rate controller gains are obtained by minimizing the performance index, either the integral square error (ISE) or the integral absolute error (IAE). We compare the performances of the proposed algorithm, the RED algorithm and the PI controller for AQM through ns simulations.