The following is a proof I have seen in mathexchange for the statement in the title:
Suppose $$\tag{1}\lim\limits_{x\rightarrow\infty}f(x)\ne 0.$$
Then we may, and do, select an $\alpha>0$ and a sequence $\{x_n\}$ so that for any $n$, $$\tag{2}x_n\ge x_{n-1}+1$$ and $$\tag{3}|f(x_n)|>\alpha.$$
Now, since $f$ is uniformly continuous, there is a $1>\delta>0$ so that $$\tag{4}|f(x)-f(y)|<\alpha/2,\quad\text{ whenever }\quad |x-y|<\delta.$$
Consider the contribution to the integral of the intervals $I_n=[x_n-\delta/2,x_n+\delta/2]$: We have, by (3), and (4) that $$\biggl|\,\int_{I_n} f(x)\, dx\,\biggr|\ge {\alpha\over2}\cdot \delta$$ for each positive integer $n$.
But, by (2), the $x_n$ tend to infinity. This implies that $\int_a^\infty f(x)\,dx$ diverges, a contradiction.
Having obtained a contradiction, our initial assumption, (1), must be incorrect. Thus, we must have $\lim\limits_{x\rightarrow\infty}f(x)= 0 $.
Can anyone explain why (3) and (4) imply that $\biggl|\,\int_{I_n} f(x)\, dx\,\biggr|\ge {\alpha\over2}\cdot \delta$? It may seem trivial but I can't see why. Shouldn't it imply the exact opposite?
$(3)$ means $f(x_n)>\alpha $ or $f(x_n)<-\alpha$. In the first case, $(4)$ implies $f(y)>f(x_n)-\frac\alpha2>\frac\alpha2$ for all $y$ with $|y-x_n|<\delta$. Then $\int_{I_n}f(x)\,\mathrm dx\ge |I_n|\cdot \frac\alpha2=\delta\cdot \frac\alpha2$. In the scond case, similarly $f(y)<f(x_n)+\frac\alpha2<-\frac\alpha2$ and $\int_{I_n}f(x)\,\mathrm dx\le -\delta\cdot \frac\alpha2$.
Incidentally, we could make $I_n$ twice as large, $I_n=(x_n-\delta,x-n+\delta)$ and thereby a slightly better estimate $|\int_{I_n}f(x)\,\mathrm dx|\ge\alpha\delta$.