Solution by tadpoleloop.
Let P(x,y) be
f(f(x)+xf(y))=x+xf(y).
There is some y0 with f(y0)=−1, since f≡−1 is not a solution. Then the right side of P(x,y0) is x(1+f(y0)), which ranges over all real numbers as x varies. Hence f is surjective.
Choose k such that f(k)=0. From P(x,k),
f(f(x))=x,
so f is injective. Now choose a with f(a)=0. In P(f(a),y), using f(f(a))=a, we get
f(a+f(a)f(y))=f(a)+f(a)f(y).
Since f is surjective and f(a)=0, the expression a+f(a)f(y) ranges over all real numbers. Therefore, for some constant c=f(a)−a,
f(t)=t+c
for all real t. But f(f(x))=x gives x+2c=x, so c=0. Hence
f(x)=x for all x.
Direct substitution verifies that this function works.