  We optimize number squeezing when splitting a mesoscopic Bose Einstein
condensate. Applying optimal control theory to a realistic description of the
condensate allowed us to identify a form of the splitting ramp which
drastically outperforms the adiabatic splitting. The results can be interpreted
in terms of a generic two-mode model mapped onto a parametric harmonic
oscillator. This optimal route to squeezing paves the way to a much longer
phase coherence and atom interferometry close to the Heisenberg limit.
