  We consider the problem of recovering a vector $\beta_o \in \mathbb{R}^p$
from $n$ random and noisy linear observations $y= X\beta_o + w$, where $X$ is
the measurement matrix and $w$ is noise. The LASSO estimate is given by the
solution to the optimization problem $\hat{\beta}_{\lambda} = \arg \min_{\beta}
\frac{1}{2} \|y-X\beta\|_2^2 + \lambda \| \beta \|_1$. Among the iterative
algorithms that have been proposed for solving this optimization problem,
approximate message passing (AMP) has attracted attention for its fast
convergence. Despite significant progress in the theoretical analysis of the
estimates of LASSO and AMP, little is known about their behavior as a function
of the regularization parameter $\lambda$, or the thereshold parameters
$\tau^t$. For instance the following basic questions have not yet been studied
in the literature: (i) How does the size of the active set
$\|\hat{\beta}^\lambda\|_0/p$ behave as a function of $\lambda$? (ii) How does
the mean square error $\|\hat{\beta}_{\lambda} - \beta_o\|_2^2/p$ behave as a
function of $\lambda$? (iii) How does $\|\beta^t - \beta_o \|_2^2/p$ behave as
a function of $\tau^1, \ldots, \tau^{t-1}$? Answering these questions will help
in addressing practical challenges regarding the optimal tuning of $\lambda$ or
$\tau^1, \tau^2, \ldots$. This paper answers these questions in the asymptotic
setting and shows how these results can be employed in deriving simple and
theoretically optimal approaches for tuning the parameters $\tau^1, \ldots,
\tau^t$ for AMP or $\lambda$ for LASSO. It also explores the connection between
the optimal tuning of the parameters of AMP and the optimal tuning of LASSO.
