We develop a variational wave function for the ground state of a one-dimensional bosonic lattice gas. The variational theory is initially developed for the quantum rotor model and later on extended to the Bose- Hubbard model. This theory is compared with quasi-exact numerical results obtained by Density Matrix Renormalization Group (DMRG) studies and with results from other analytical approximations. Our approach accurately gives local properties for strong and weak interactions, and it also describes the crossover from the superfluid phase to the Mott-insulator phase.