In this paper we prove the the local Lipschitz continuity for solutions to a class of obstacle problems of the type[[EQUATION]] Here $\mathcal{K}_{\psi}(\Omega)$ is the set of admissible functions $z \in {u_0 + W^{1,p}(\Omega)}$ {for a given $u_0 \in W^{1,p}(\Omega)$}such that $z \ge \psi$ a.e. in $\Omega$, $\psi$ being the obstacle and $\Omega$ being an open bounded set of $\mathbb{R}^n$, $n \ge 2$.The main novelty here is that we are assuming that the integrand $ F(x, Dz)$ satisfies $(p,q)$-growth conditions and as a function of the $x$-variable belongs to a suitable Sobolev class. We remark that the Lipschitz continuity result is obtained under a sharp closeness condition between the growth and the ellipticity exponents.Moreover, we impose lessrestrictive assumptions on the obstacle with respect to the previous regularity results.Furthermore, assuming the obstacle $\psi$ is locally bounded, we prove the local boundedness of the solutions to a quite large class of variational inequalities whose principal part satisfies non standard growthconditions.