Optimal solutions to the nonlinear, hydrostatic, Boussinesq equations are developed for steady, density-stratified, topographically controlled flows characterized by blocking and upstream influence. These flows are jet-like upstream of an isolated obstacle and are contained within an asymmetric, thinning stream tube that is accelerated as it passes over the crest. A stagnant, nearly uniform-density isolating layer, surrounded by a bifurcated uppermost streamline, separates the accelerated flow from an uncoupled flow above. The flows are optimal in the sense that, for a given stratification, the solutions maximize the topographic rise above the blocking level required for hydraulic control while minimizing the total energy of the flow. Hydraulic control is defined mathematically by the asymmetry of the accelerated flow as it passes the crest. A subsequent analysis of the Taylor–Goldstein equation shows that these sheared, non-uniformly stratified flows are indeed subcritical upstream, critical at the crest, and supercritical downstream with respect to gravest-mode, long internal waves. The flows obtained are relevant to arrested wedge flows, selective withdrawal, stratified towing experiments, tidal flow over topography and atmospheric flows over mountains.