Assume we have a Riemannian manifold $M$ embedded isometrically in $\mathbb{R}^n$ (It may not be closed or open). Let $V(i)$ be a smooth orthonormal vector field on $M$ (which can be extended to a basis in $T(\mathbb{R}^n)$ at every point). Given that a smooth function $f$ on $M$ can be extended to $\mathbb{R}^n$ smoothly (say, the extended function is $g$), can it be extended in a way such that gradient of $g$ lies in $TM$ for all points in $M$?

No: Take a spiral in $\mathbb R^2$ like $\mathbb R_{>0}\ni t\mapsto t.e^{it}$ with the induced metric, $g(x,y)=x$. You cannot change $g$ such that its gradient is tangent to the spiral: You have problems at 0. 

