The idea is to reduce the proof to the compact case.
Let $L= \lim_{x\to\infty} f(x)$. Choose $\epsilon>0$, and $M>0$ such that if $x>M$, then $|f(x)-L| < \frac{1}{2}\epsilon$.
$f$ is continuous, hence uniformly continuous on $[a,M+1]$. Choose $0<\delta<1$ so that if $x,y \in [a,M+1]$ and $|x-y| < \delta$, then $|f(x)-f(y)| < \epsilon$.
Now choose $x,y \in [a,\infty)$ such that $|x-y| < \delta$. Then either $x,y \in [a,M+1]$ or $x,y \in (M, \infty)$. In the first case we have $|f(x)-f(y)| < \epsilon$, in the second case, we have $|f(x)-f(y)| \le |f(x)-L|+|f(y)-L|< \frac{1}{2}\epsilon + \frac{1}{2}\epsilon = \epsilon$.