Show that if $f$ is a continuous function on the real line such that for all $x$ and $y$, $f ((x + y)/2) = (f(x) + f (y)) /2$, then $f (x) = ax + b$ for some real $a$ and $b$.
I have solved this problem, but there is a second part:
If $f$ is Borel and satisfies the functional equation, show $f(x)=ax+b$
I'm not getting how to make use of the Borel-measurability property actually holds for all Borel $f$.
Up to replacing $f$ with $f-f(0)$, you can assume that $f(0)=0$. Using the equation with $x=2a,y=0$ tells you that $f(2a)=2f(a)$ for any real $a$. So, using the equation again with $x=2s,y=2t$, you discover that $$ f(s+t)=f(s)+f(t)\quad\text{for any }s,t\in\mathbb{R}.\quad(*) $$
As $f:\mathbb{R}\to\mathbb{R}$ is Borel, the sets $f^{-1}([-k,k])$ form an increasing sequence of Borel sets whose union is $\mathbb{R}$. So there exists some $k>0$ such that $A:=f^{-1}([-k,k])$ has positive Lebesgue measure. Let $B:=\mathbb{R}\setminus[-k,k]$, which is a nonempty open set such that $f(A)\cap B=\emptyset$.
In these notes (p. 4) the following is proved: if $f$ satisfies $(*)$, $f$ is not linear, $A$ is Borel, $B$ is a nonempty open set and $f(A)\cap B=\emptyset$, then the measure of $A$ must be zero. This contradicts the above choice of $A$ and $B$, so $f$ has to be linear.