I suppose that you are discussing Betti cohomology with coefficient in $\mathbb{Q}$.

Using the long exact sequence
$$\cdots \to H^{k}(X,\mathbb{Q}) = H^{k+2r}(Y,Y \backslash X,\mathbb{Q}) \to H^{k+2r}(Y,\mathbb{Q}) \to H^{k+2r}(Y\backslash X,\mathbb{Q}) \to \cdots$$
we see that the surjectivity of the Gysin morphism $f_\*$ is equivalent to the vanishing of the pullback morphism $i^*:H^{k+2r}(Y,\mathbb{Q}) \to H^{k+2r}(Y\backslash X,\mathbb{Q})$, where $i$ is the open immersion $Y\backslash X \to Y$. (Since your $Y$ is smooth and projective, the Hodge structure on $H^{k+2r}(Y,\mathbb{Q})$ is pure, which explains the equivalence given by Dan)

We know that $Ker \ i^*$ is a sub-Hodge structure of (Hodge) coniveau $\ge r$ of $H^{k+2r}(Y,\mathbb{Q})$, it says in particular that if you want your Gysin morphism $f_{*}$ to be surjective, your $H^{k+2r}(Y, \mathbb{Q})$ should at least have coniveau $\ge r$! ($\leftarrow$ This should be seen as an exclamation mark, not a factorial notation...)