This is not a full answer (at the moment), but it is something, and it is too long for a comment.
It seems that the answer to your question is positive if and only if $M$ has the following
Property: Every $d$-form $\omega$ on $M$ which vanishes near the boundary and satisfies $\int_M\omega=0$ has a primitive which vanishes near the boundary.
Before explaining the relation between this property and your question, it should be pointed out that the $d$-dimensional ball has this property. In fact, this is just the compactly supported Poincaré lemma. Unfortunately, I am not sure what the case is for a general manifold, but I would guess that many users here know much more than me about compactly supported cohomology. Perhaps one of those knowledgeable users can help.
Assume that $M$ possesses the above property. Choose a $d-1$-form $\eta_0$ such that $d\eta_0=\omega_0$. For every $t$, write $$\alpha_t:=\frac{d}{dt}\omega_t.$$ Then $\alpha_t$ is a $d$-form which vanishes near the boundary and whose integral vanishes. As $M$ has the property, $\alpha_t$ has a primitive $\beta_t$ which vanishes near the boundary. Define the family $\eta_t$ to be the unique extension of $\eta_0$ satisfying $$\frac{d}{dt}\eta_t=\beta_t.$$
The converse can be proved in a similar manner.
Edit: For simplicity, the above-mentioned property is just the following. Write $M_0=M\setminus\partial M$. Then $$H^d_c(M_0)=\mathbb{R}.$$ As I already wrote, I don't know which manifolds satisfy this equality, but I'm sure answers can be found in the literature.
Edit #2: I just found the general version of Poincaré duality, which holds for not-necessarily-compact manifolds. It says that if $X$ is an oriented $d$-dimensional manifold, then integration gives an isomorphism $$H^{d-k}(X)\xrightarrow{\sim}\left(H^k_c(X)\right)^*.$$In particular, it means that in your case, $$H^d_c(M\setminus\partial M)=\mathbb{R},$$(assuming $M$ is connected) and so, the answer to your question is positive.