We present a rigorous analysis of the generalized Landau-Zener problem for the two-level interacting Bose-Einstein condensates. We show that the dynamics of the system is accurately, in detail, described by a two-term variational ansatz that is valid for the whole time domain and is applicable for any set of involved parameters. Applying an exact third order nonlinear differential equation we construct an advanced fifth order polynomial equation for the final transition probability serving as a highly accurate generalized Landau-Zener formula.