  The presence of a significant amount of gravitational radiation in the early
Universe affects the total energy density and hence the expansion rate in the
early epoch. In this work, we develop a physical model to connect the parameter
of relativistic degree of freedom $N_\mathrm{eff}$ with the amplitude and shape
of primordial tensor power spectrum, and use the CMB temperature and
polarization data from {\it Planck} and BICEP2/KECK Array, and the primordial
deuterium measurement from damped Lyman-$\alpha$ (DLA) systems to constrain
this model. We find that with this extra relation $\Delta N_{\rm eff}(r,n_{\rm
t})$, the tensor-to-scalar ratio $r$ is constrained to be $r<0.07$ ($3\sigma$
C.L.) and the tilt of tensor power spectrum is $n_\mathrm{t}=-0.01\pm 0.31$
($1\sigma$ C.L.) for {\it Planck}+BICEP2+KECK+[D/H] data. This achieves a much
tighter constraint on the tensor spectrum and provides a stringent test for
cosmic inflation models. In addition, the current constraint on $N_{\rm
eff}=3.122 \pm 0.171$ excludes the possibility of fourth neutrino species at
more than $5\sigma$ C.L.
