Placing $k$ balls into $n$ boxes is equivalent to choosing a sequence of $k$ stars and $n-1$ bars. These $k$ stars will divide the bars into $k+1$ contiguous (possibly empty) groups. Letting $b_i$ be the number of bars in the $i^\text{th}$ group, for $i\in \{1,\dots,k+1\}$, this means that placing $k$ balls into $n$ boxes is equivalent to counting nonnegative integer solutions to the equation
$$
b_1+b_2+\dots+b_{k+1}=n-1.
$$
How does the requirement that there are no two adjacent empty boxes translate to solutions of this equation? Note that if there are three adjacent bars in the original problem, then there will be two adjacent empty boxes, so in this new problem, we must require $b_i\le 2$ for each $i\in \{1,\dots,k+1\}$. There is one additional wrinkle; two bars at the beginning or end of the sequence also creates two empty boxes. Therefore, the full set of constraints is as follows:
$$
\begin{align*}
b_1+b_2+\dots+b_{k+1}&=n-1
\\
b_i&\le 2 & (2\le i \le k)
\\
\max(b_1,b_{k+1})&\le 1
\end{align*}
$$
Using generating functions, as described in Marc van Leeuwen's answer to the general balls-into-boxes problem with upper limits, the number of nonnegative integer solutions to the above is
$$
[x^{n-1}](1+x)^2(1+x+x^2)^{k-1}\qquad (k\ge 1)
$$
The notation $[x^{m}]f(x)$ means "the coefficient of $x^m$ in the power series $f(x)$". This is further equal to
$$
[x^{n-1}](1+x+x^2)^{k-1}+2[x^{n-2}](1+x+x^2)^{k-1}+[x^{n-3}](1+x+x^2)^{k-1},
$$
which we can evaluate using three applications of this formula:
$$
[x^m](1+x+x^2)^{k-1}=[x^m](1-x^3)^{k-1}(1-x)^{-k+1}=\sum_{i=0}^{k-1}(-1)^i\binom{k-1}i\binom{k-2+m-3i}{m-3i}.
$$