I cannot find this pairing in terms of differential forms in any literature, so let me answer it myself.
Let $M$ be a compact with boundary $\partial M$. Let $M^{\circ}=M\setminus\partial M$ be the interior. Then there is an isomorphism between relative (de Rham) cohomology and the cohomology with compact support
$$H^k(M,\partial M)\cong H_c^k(M^{\circ}). \label{1}\tag{1}$$
On the other hand, there is a natural pairing
$$H^k_c(M^{\circ})\times H^{n-k}(M)\to \mathbb R, \ (\phi,\psi)\mapsto \int_{M}\phi\wedge\psi.\label{2}\tag{2}$$
So if we can find an explicit isomorphism for \eqref{1}, then the pairing \eqref{2} can be transformed into a pairing between $H^k(M,\partial M)$ and $H^{n-k}(M)$.
First of all, there is a different version of relative cohomology, obtained as cohomology of complex $\Omega^*(M,\partial M)$ of differential forms on $M$ that vanishes on $\partial M$ (cf. Originally from [Godbillion] defined for a pair of a smooth manifold and a smooth closed submanifold, but should apply to a manifold with boundary as well). We denote this cohomology theory as $H^*(M,\partial M)_G$. It turns out that the natural inclusion $H^k(M,\partial M)_G\to H^k(M,\partial M)$ is an isomorphism and the inverse map is given by $(\alpha,\theta)\mapsto \alpha-d(\pi^*\theta\wedge\eta),$
where $\eta$ is a bump function supported on $T$ and has constant value $1$ in a smaller neighborhood $T'$. (See this post)
Second, since $\partial M$ is homotopy equivalent to its tubular neighborhood, it turns out that the natural inclusion $H^k_c(M^{\circ})\to H^k(M,\partial M)_G$ is an isomorphism (cf. [Godbillion, Cha. XII, Theorem 3.1]) and the inverse map is $\omega'\mapsto \omega'-d(u\wedge\eta)$, where $du=\omega'$ on $T'$. Note one can choose $u$ to vanish on $\partial M$.
Now let $(\alpha,\theta)\in H^k(X,Y)$, and $\beta\in H^{n-k}(M)$. Write $\lambda=\pi^*\theta-u$ where $du=\omega-d\pi^*\theta$ on $T'$. Combine the isomorphisms $H^k_c(M^{\circ})\cong H^k(M,\partial M)_G\cong H^k(M,\partial M)$, then the pairing \eqref{2} becomes
$$\int_{M}\big(\alpha-d(\lambda\wedge\eta)\big)\wedge\beta=\int_M\alpha\wedge \beta-\int_Td(\lambda\wedge\eta)\wedge\beta.$$
Apply the Stokes' theorem to the second term and use the fact that $\eta$ is supported on $T$, we have
$$\int_Td(\lambda\wedge\eta)\wedge\beta=\int_Td(\lambda\wedge\eta\wedge\beta)=\int_{\partial M}\lambda\wedge\beta.$$
Now since $u$ vanishes on $\partial M$, we obtain the pairing formula
$$((\alpha,\theta),\beta)\mapsto \int_{M}\alpha\wedge\beta-\int_{\partial M}\theta\wedge\beta_{|\partial M}.$$
Note there is a minus sign on the second term. Here the orientation of $\partial M$ is the induced orientation from $M$ (normal vector points outward).