Here is a counterexample. Let's work over a field $k$ (you can take $k=\mathbb{C}$). Take $X=\mathbb{P^1}\times\mathbb{P^1}$ and let $\mathcal{F}=\mathcal{O}(-1)\boxtimes\mathcal{O}(-2)$. Take any affine covering $B$ and let $A=B\cup \{U\}$, where $U$ is the complement to $\{p\}\times \mathbb{P}^1$, $p$ being any $k$-point. Since, $B$ is affine, the corresponding Čech complex computes cohomology of $\mathcal{F}$, which is $0$. It is enough to show that $H^\bullet(A,\mathcal{F})$ is nonzero.
In order to compute $H^\bullet(A,\mathcal{F})$, let us use the Čech-to-derived functor cohomology spectral sequence. Its second page is
$$ E^{p,q}_2 = H^p(A,\mathcal{H}^q(X, \mathcal{F})) \Rightarrow H^{p+q}(X, \mathcal{F}),$$
and it our case it converges to 0! Here $\mathcal{H}^q(X, \mathcal{F})$ is just the presheaf whose sections over an open $V$ equal the cohomology group $H^q(V, \mathcal{F})$. What does this spectral sequence look like? I claim that for $p>0$ and $q>0$ one has $E^{p,q}_2 = 0$. Indeed, every intersection of at least two elements in $A$ is affine (either use the obvious $B$ and check it by hand or use the fact that the inclusion morphism $U\to X$ is affine since $U$ is a complement of an effective Cartier divisor), and coherent sheaves do not have higher cohomology over affine opens. Next, let us look at $E^{0,q}_2$. Check that in our particular case $E^{0,1}_2=H^1(U,\mathcal{F}) \simeq k[t]$ (the functions on $\mathbb{P}^1\setminus \{p\}$). Finally, recall that the bottom row of the spectral sequnce $E^{p,0}_2=H^p(A,\mathcal{F})$. Here is what we get (the lower left corner of the spectral sequence).
$$
\require{AMScd}
\begin{CD}
H^1(U,\mathcal{F}) @. 0 @. 0\\
@. @.\\
H^0(A,\mathcal{F}) @. H^1(A,\mathcal{F}) @. H^2(A,\mathcal{F})
\end{CD}
$$
Since the spectral sequence converges to 0, the differential $d^{0,1}_2:H^1(U,\mathcal{F}) \to H^2(A,\mathcal{F})$ must be an isomorphism. Thus, $H^2(A,\mathcal{F})\simeq k[t]$, and the restriction map $H^2(A,\mathcal{F})\to H^2(B,\mathcal{F})=0$ is not injective.
*
in posts on SE sites without using MathJax. If there are two of them in a paragraph, then it's easy for them accidentally to get mis-interpreted as switching to italics. $\endgroup$