We present a detailed analysis of the phase transition in the standard model at finite temperature. Using an improved perturbation theory, where plasma masses are determined from a set of one-loop gap equations, we evaluate the effective potential V ef f (ϕ, T ) in nextto-leading order, i.e., including terms cubic in the gauge coupling g, the scalar self-coupling λ 1/2 and the top-quark Yukawa coupling f t . The gap equations yield a non-vanishing magnetic plasma mass for the gauge bosons, originating from the non-abelian self-interactions. We discuss in detail size and origin of higher order effects and conclude that the phase transition is weakly first-order up to Higgs masses of about 70 GeV , above which our calculation is no longer self-consistent. For larger Higgs masses even an approximation containing all g 4 contributions to V ef f is not sufficient, at least a full calculation to order g 6 is needed. These results turn out to be rather insensitive to the topquark mass in the range m t = 100 − 180 GeV . Using Langer's theory of metastability we calculate the nucleation rate of critical droplets and discuss some aspects of the cosmological electroweak phase transition.