Are you familiar with the extreme value theorem?
https://en.wikipedia.org/wiki/Extreme_value_theorem
In this case $f(x) \le 2$ so $f$ is continuous and bounded. But we haven't found a closed interval for this to apply.
Case 1:
Suppose there is an $d$ so that $f(d) > 1$. Let's let $\epsilon = f(d) -1 > 0$.
Let $x > \frac 1{\epsilon}$ then $\frac 1{x+1} < \frac 1{x} < \epsilon$
Then $f(x) \le \frac {x+2}{x+ 1} = \frac {x+1}{x+1} + \frac{1}{x+1} = 1 + \frac{1}{x+1} < 1 + \epsilon = f(d)$ for all $x > \frac 1{\epsilon}$.
(This means $d < \frac 1 {\epsilon}$. Otherwise we'd have the absurd result $f(d) < f(d)$.)
Okay. so $f$ achieves a maximum on $[0, \frac 1{\epsilon}]$ by extreme value thereom. And as this maximimum is at least as large as $f(d)$ it is larger than $f(x)$ for all $x \in (\frac 1{\epsilon}, \infty)$ So it is a maximum on all $[0,\infty)$.
Case 2: $f(x) \le 1$ for all $x \in [0,\infty)$.
Then $f(0) = 1$ is maximal.