I am looking for a smooth (continuous differentiable) approximation of the following two three-phased functions with breakpoints at $B_1$ and $B_2$:$$ y_1(x, B_1, B_2, a, b) = \begin{cases} a; & x < B_1\\ a + b(x - B_1); & B_1 \leqslant x \leqslant B_2\\ a + b(B_2 - B_1); & x > B_2 \end{cases}, $$

and$$ y_2(x, B_1, B_2, a, b_1, b_2, b_3) = \begin{cases} a + b_1(x - B_1); & x < B_1\\ a + b_2(x - B_1); & B_1 \leqslant x \leqslant B_2\\ a + b_2(B_2 - B_1) + b3(x - B_2); & x > B_2 \end{cases}. $$

The derivative equals $b$ or $b2$ at $\dfrac{1}{2}(B_1+B_2)$ for functions $y_1$ and $y_2$, and equals $b1$ at $x\ll B_1$ and $b3$ at $x\gg B_2$ for function $y_2$.
I would like one additional parameter $s$ that would describe how closely the smooth function would approximate the piecewise linear versions. The function should extrapolate more or less linearly on both sides.
Any thoughts about what could be good functions for this? I want the functions to be smooth and continuously differentiable as that would help me to fit these parameters as I could then provide the analytical first-order derivative.
$\def\peq{\mathrel{\phantom{=}}{}}$Redefine $y_2(x)$ as$$ y_2(x) = \begin{cases} a_1 x + b_1; & x \leqslant x_1\\ a_2 x + b_2; & x_1 < x \leqslant x_2\\ a_3 x + b_3; & x > x_2 \end{cases}. $$ Assume that $a_2 > a_1$ and $a_2 > a_3$. Extending from your brother's construction, here is an approximation of two parameters $s$ and $n$:\begin{align*} y_2(x; s, n) &= \frac{1}{2} (a_1 + a_3)x + \frac{1}{2} (b_1 + b_3)\\ &\peq + \frac{1}{2} (a_2 - a_1) \left((x - x_1)^{2n} + (a_2 - a_3)^{2n} s^{2n}\right)^{\frac{1}{2n}}\\ &\peq + \frac{1}{2} (a_3 - a_2) \left((x - x_2)^{2n} + (a_2 - a_1)^{2n} s^{2n}\right)^{\frac{1}{2n}}, \end{align*} where $s > 0$, $n \in \mathbb{N}_+$. The smaller the $c$ or the larger the $n$, the better the approximation.