Solution by NO_SQUARES.
The answer is f(x)≡x and f(x)≡−x.
Claim. f is injective.
Proof. Suppose that f(y1)=f(y2)=t. Then P(1,y1) gives f(t+t)=f(1)t+y1 and P(1,y2) gives f(t+t)=f(1)t+y2, so y1=y2. □
Note that P(y,x) gives f(yf(x)+f(yx))=f(y)f(x)+yx=f(x)f(y)+xy=f(xf(y)+f(xy)). Since f is injective, we obtain yf(x)+f(yx)=xf(y)+f(xy) or yf(x)=xf(y). Taking y=1, we get f(x)=xf(1)=xa (here a=f(1)) for all real numbers x.
Now we have a(xay+axy)=axay+xy, i.e. 2a2=a2+1, so a=±1.