Prelim problem $\sup_{\bar\Omega}|\nabla u|^2\leq C(\sup_{\Omega}u^2+\sup_{\Omega}f^2+\sup_{\Omega}|\nabla f|^2)+\sup_{\partial\Omega}|\nabla u|^2$ 
This is an old prelim problem. Let $\Omega \subset \mathbb{R}^n$ open and bounded with smooth boundary. If $u\in C^3(\bar\Omega)$ solves 
  $$ -\sum_{i,j=1}^n a_{ij}(x)\,u_{x_ix_j}(x)=f(x)\quad \mbox{in }\Omega $$ 
  with a uniformly elliptic operator and $a_{ij},f\in C^1(\bar\Omega)$. Use the function $v=|\nabla u|^2+\lambda u^2$ with a constant $\lambda >0$ to be chosen, to show there exists a constant $C$ depends on $\Omega$ and $a_{ij}$ such that
  $$\sup_{\bar\Omega}|\nabla u|^2\leq C(\sup_{\Omega}u^2+\sup_{\Omega}f^2+\sup_{\Omega}|\nabla f|^2)+\sup_{\partial\Omega}|\nabla u|^2.$$

My attempt: I was trying to show that $Lv\leq 0$ for a certain $\lambda$ where $L= -\sum_{i,j=1}^n a_{ij} \frac{\partial^2}{\partial x_i \partial x_j}$, then apply maximum principle to have $\sup_{\bar\Omega}v\leq \sup_{\partial \Omega}v$. But if suppose we proved $Lv\leq 0$, then $\sup_{\bar\Omega}|\nabla u|^2\leq \sup_{\bar\Omega}v\leq \sup_{\partial\Omega}|\nabla u|^2+\lambda \sup_{\partial\Omega}u^2$ which for me doesn't look like it will help. Anyway,
$$L(\lambda u^2)= -2\lambda \sum_{i,j=1}^n a_{ij} u_{x_i}u_{x_j}+2\lambda u f\leq -2\lambda \alpha |\nabla u|^2+2\lambda u f $$
where $\alpha>0$ is the ellipticity constant.
\begin{align}
L((u_{x_k})^2)&=-2 \sum_{i,j=1}^n a_{ij}u_{x_kx_i}u_{x_kx_j}-2u_{x_k}\sum_{i,j=1}^n a_{ij}u_{x_ix_jx_k}\\\\
&\leq -2\alpha |\nabla(u_{x_k})|^2+2u_{x_k}f_{x_k}+2u_{x_k}\sum_{i,j=1}^n (a_{ij})_{x_k}u_{x_ix_j}.
\end{align}
Thus,
\begin{align}
L(|\nabla u|^2)&\leq -2\alpha |D^2u|^2+2\sum_{k=1}^n u_{x_k}f_{x_k}+2C_0\sum_{k=1}^n u_{x_k}\sum_{i,j=1}^n u_{x_ix_j}\\\\
&\leq -2\alpha |D^2u|^2+2|\nabla u|\,|\nabla f|+2C_0 |\nabla u||D^2u|
\end{align}
 where $D^2u$ is Hessian matrix and $C_0=\sup_{\bar\Omega}|\nabla(a_{ij})|$. Since $ab\leq \epsilon a^2+\frac{1}{4\epsilon}b^2$ for all $\epsilon>0$, with $a=|D^2u|$, $b=|\nabla u|$, and $\epsilon=\alpha/C_0$, we obtain
\begin{align}
L(|\nabla u|^2)&\leq 2|\nabla u|\,|\nabla f|+\frac{C_0^2}{2\alpha} |\nabla u|^2.
\end{align}
Hence,
\begin{align}
L(v)&\leq -2\lambda \alpha |\nabla u|^2+2\lambda u f+2|\nabla u|\,|\nabla f|+\frac{C_0^2}{2\alpha} |\nabla u|^2.
\end{align}
Then I don't know what to do. Any help is appreciated.
 A: The trick is to introduce one more thing to hit with $L$.  You may suppose without loss of generality (otherwise just translate your domain) that 
$$ \Omega \subseteq \{x \in \mathbb{R}^n : 0 < x \cdot \xi < d\}$$
for some $d>0$ and $\xi \in\mathbb{R}^n$ with $|\xi|=1$.
Then the step you're missing is to show that
$$ L( |\nabla u|^2 + \lambda u^2 + e^{\beta x \cdot \xi}) \le 0$$
when you choose $\beta \in \mathbb{R}$ appropriately.  You're on the right track with what you wrote above.  You just need this extra term.
EDIT: 
Here is a hint for why you need the exponential term. You have:
\begin{align}
L(v)&\leq -2\lambda \alpha |\nabla u|^2+2\lambda u f+2|\nabla u|\,|\nabla f|+\frac{C_0^2}{2\alpha} |\nabla u|^2
\end{align}
for any choice of $\lambda$.  Apply Cauchy's inequality to bound
$$
2 |\nabla u| |\nabla f| \le | \nabla u|^2 + |\nabla f|^2
$$
and then choose 
$$
 \lambda = \frac{1}{2\alpha } \left( 1  + \frac{C_0^2}{2\alpha} \right).
$$
Plugging this in above then shows that 
$$
L(v) \le 2 \lambda |u| |f| + |\nabla f|^2.
$$
Now we're stuck and we need to introduce a term $\psi$ such that 
$$
L (\psi) \le  -(2 \lambda |u| |f| + |\nabla f|^2).
$$
If you can find such a $\psi$ then you know that 
$$
L(v + \psi) \le 0
$$
and you can then apply the maximum principle.  The exponential I suggest is such a $\psi$.
EDIT 2: Here are the last details.  
I've realized that since your operator $L$ has no first or zeroth order terms, we can use a simpler $\psi$, though my original suggestion also works.
Consider the function $\psi(x) = \beta ( x \cdot \xi)^2/2$ for $\beta >0 $ to be determined.  Here we are assuming my hint about the domain.  We compute
$$
L\psi(x) = -\sum_{ij}a_{ij}(x) \partial_i \partial_j [\beta ( x \cdot \xi)^2/2] = - \beta \sum_{ij}a_{ij}(x) \xi_i \xi_j 
$$
and then use ellipticity to estimate
$$
\sum_{ij}a_{ij}(x) \xi_i \xi_j  \ge \alpha |\xi|^2 = \alpha
$$
since $\xi$ is a unit vector.  Hence
$$
L\psi(x) \le -\alpha \beta.
$$
Set 
$$
C_1(u,f) = \sup_{\Omega}[\lambda |u|^2 + \lambda |f|^2 + |\nabla f|^2] \ge 0
$$
where $\lambda$ is understood to have the value chosen above.
Combining the above inequalities, we find that 
$$
L(v + \psi) \le C_1(u,f) -\alpha \beta. 
$$
We then choose 
$$
\beta = \frac{C_1(u,f)}{\alpha} >0
$$
and deduce that with this choice of $\lambda$ and $\beta$, we have the inequality
$$
L(|\nabla u|^2 + \lambda u^2 +\beta (x\cdot \xi)^2/2) \le 0.
$$
Now the weak maximum principle tells us that 
$$
\sup_{x \in \bar{\Omega}} [|\nabla u(x)|^2 + \lambda u(x)^2 + \beta (x\cdot \xi)^2/2] \le \sup_{x \in \partial \Omega} [|\nabla u(x)|^2 + \lambda u(x)^2 + \beta (x\cdot \xi)^2/2].
$$
We estimate the right hand side by (using the fact that $0 < x\cdot \xi < d$)
$$
\sup_{x \in \partial \Omega} |\nabla u(x)|^2 + \lambda \sup_{x\in \bar{\Omega}} u(x)^2 + \beta \frac{d^2}{2}.
$$
Finally, by looking at the values of $C_1(u,f), \beta,\lambda$ we find that
$$
\sup_{x \in \bar{\Omega}} |\nabla u(x)|^2  \le \sup_{x \in \partial \Omega} |\nabla u(x)|^2  + C(\Omega,\alpha,C_0) \left(\sup_{x \in \bar{\Omega}} |u(x)|^2 + \sup_{x \in \bar{\Omega}} (|f(x)|^2 + |\nabla f(x)|^2)  \right) 
$$
and we're done.
