As discussed in the comments you need to have $a_1=a_2$ (note that $(1,0)\in A_1\cap A_2$), so the only options are 2) and 4), where 2) is the stronger assumption. We can show however that 4) suffices.
Indeed we may apply Urysohn to the sets $A=A_1\cup A_2$ and $B=A_3$. Both sets are closed and disjoint, moreover $\mathbb R^2$ is normal. If $a_1=a_3$ choose $f\equiv a_1$. So assume $a_1\neq a_3$.
By Urysohn there exists a continuous function $f:\mathbb R^2\to [0,1]$ with $f(A)=0$ and $f(B)=1$. Postcompose this map with the canonical homeomorphism $[0,1]\to [a_1,a_3]$ if $a_1< a_3$ or the strictly decreasing homeomorphism $[0,1]\to [a_3,a_1]$ if $a_3< a_1$. We are done.
Edit: Maybe this is actually a bit of an overkill. Since your sets are given explicitely you can just define $f(x,y)=\begin{cases}a_1& \text{ if $x\leq 1$ }\\ a_3&\text{ if $x\geq 2$ }\\ a_1+(x-1)(a_3-a_1)&\text{ if $1\leq x\leq 2$ }\end{cases}$