First let's prove that f is injective: suppose that f(a)=f(b). Then
2bf(f(b))2af(f(a))=f(b)(b+f(f(b)))f(a)(a+f(f(a)))⟺ba=b+f(f(b))a+f(f(a))=f(f(b))f(f(a))=1⟺a=b.
Then f is invertible. Since the given equation is equivalent to
f(x)2=x1+f(f(x))1,
defining f(n)(x)1=an, n∈Z, we have, plugging x→f(n)(x),
2an+1=an+an+2⟺an+2−an+1=an+1−an,
that is, an is an arithmetic progression. Since an>0 for all n,x, it has to be constant, and a1=a0⟺f(x)1=x1⟺f(x)=x, which can be easily verified to satisfy the equation.