If a one parameter subgroup $\phi:\mathbb{R}\rightarrow G$ of a Lie group $G$ comes back infinitely often to a compact set $K$, is it all contained in a compact set?
I think $\phi(\mathbb{R})K\subset G$ should be compact but I haven't been able to prove it.
The answer to your question is positive.
Suppose that $H$ is an abelian subgroup of a Lie group $G$, then the closure $\bar{H}$ of $H$ in $G$ is a connected abelian Lie subgroup of $G$, in particular, it is properly embedded in $G$. (See the closed subgroup theorem.) This applies in your case, by taking $H=\phi(R)$.
Part 1 reduces the problem to the case of 1-parameter subgroups $H$ of connected abelian Lie groups $G$. Such group $G$ is the quotient of a simply-connected group isomorphic to $R^n$ by a discrete subgroup isomorphic to $Z^k, k\le n$. The 1-parameter subgroup $H$ lifts to a 1-parameter subgroup $L\subset R^n$. If $L$ is not contained in the linear span of $Z^k$ in $R^n$, then $L$ projects to a properly embedded subgroup of $G$ (isomorphic to $R$). If $L$ is contained in the linear span $R^k$ of $Z^k$, then $H$ is contained in the compact subgroup $R^k/Z^k=T^k$ of $G$. qed