We consider the semilinear harmonic oscillator
$ipsi_t=(-Delta +{|x|}^{2} +M)psi +partial_2 g(psi,bar psi), quad xin mathbb{R}^{d},, tin mathbb{R},$
where
M is a Hermite multiplier and
g a smooth function globally of order 3 at least. We prove that such a Hamiltonian equation admits, in a neighborhood of the origin, a Birkhoff normal form at any order and that, under generic conditions on
M related to the non resonance of the linear part, this normal form is integrable when
d = 1 and gives rise to simple (in particular bounded) dynamics when
d ≥ 2. As a consequence we prove the almost global existence for solutions of the above equation with small Cauchy data. Furthermore we control the high Sobolev norms of these solutions.