We study the entanglement entropies of an interval for the massless compact boson either on the half line or on a finite segment, when either Dirichlet or Neumann boundary conditions are imposed. In these boundary conformal field theory models, the method of the branch point twist fields is employed to obtain analytic expressions for the two-point functions of twist operators. In the decompactification regime, these analytic predictions in the continuum are compared with the lattice numerical results in massless harmonic chains for the corresponding entanglement entropies, finding good agreement. The application of these analytic results in the context of quantum quenches is also discussed.