This article presents a model-based boundary-control strategy for the drainage of a horizontal oil reservoir with a gas cap. The control objective is to maximize the net present value (NPV) of the produced oil from a well before gas is coned into the well. A nonlinear partial-differential equation (PDE) representing the reservoir dynamics has been derived. The linearized model is a parabolic PDE with mixed boundary conditions. The linearized model is used together with an output-feedback boundary-control law. Performance guarantee in the linear case is proved.