Estimating CES utility (not production) function parameters The CES utility function has the form 
\begin{equation}
u(x_1,\dots,x_n)=\left[\sum_{i=1}^n\alpha_ix_i^\rho\right]^{1/\rho},
\end{equation}
where $\alpha_i$ is the consumption share parameter and $\sigma=\frac{1}{1-\rho}$ is the elasticity of substitution. 

I'm interested in estimating the $\alpha_i$'s and $\sigma$. Since we do not directly observe utility levels, I think we can instead use data to estimate the Marshallian demand functions implied by the utility function: 
\begin{equation}
  x_i(p_1,\dots,p_n,M)=\frac{M(\alpha_i/p_i)^\sigma}{\sum_{j=1}^n\alpha_j^\sigma p_j^{1-\sigma}},\quad i=1,\dots,n.
\end{equation}
Clearly, the function is highly nonlinear in the parameters of interest. So a nonlinear estimation procedure would be required. 

Say we have data consumption $x_i$, prices $p_i$ and income $M$. How do we go about estimating the parameters $\alpha_i$'s and $\sigma$?

I can find a lot of papers on estimating the CES production function, but I don't find them helpful since I don't observe the dependent variable ($u$). Given that the CES utility is a common functional form used in the literature, I suspect its estimation must be somewhere in the literature. 

I managed to find the nonlinear least squares estimation in Stata, but I don't know how susceptible such a procedure is to misspecification and how much confidence one should put on the statistics (e.g. t-stat or p-value) produced by the program.

Any pointer to the papers/textbook chapters on the topic, as well as statistical packages that implement the estimation procedure will be greatly appreciated.
It may be interesting to exploit the homothetic separability of the CES utility function in $x$. It implies that
$$\frac{x_i}{x_j} = \left( \frac{\alpha_i}{\alpha_j}\frac{p_j}{p_i} \right)^\sigma $$
and after $log$-transformation:
$$\ln(x_i) - \ln(x_j) = \beta_{ij} + \sigma (\ln(p_j) - \ln(p_i)). $$
After adding a random term, this specification could be used to estimate the $\beta_{ij} \equiv \sigma (\ln(\alpha_i)-\ln(\alpha_j))$ and $\sigma$ parameters by OLS and in a second step identifying the $\alpha_i$ by minimum distance:
$$ \widehat{\alpha} = \arg \min_\alpha \Big(\widehat{\beta}-\widehat{\sigma}(\ln(\alpha)-\ln(P\alpha)) \Big)'\Omega^{-1} \Big( \widehat{\beta}-\widehat{\sigma}(\ln(\alpha)-\ln(P\alpha)) \Big), $$
where $P$ represents the adequate permutation matrix.
Some references estimating parameters of CES preference parameters include Diewert and Feenstra (2017) or Redding and Weinstein (2020), with a different approach, however, based on the unit expenditure function.
Most empirical contributions reject the validity of homothetic utility functions (like the CES). There are some propositions on how to built nonhomothetic CES production functions that could easily extended to utility functions, see Shimomura (1999) and the references therein. A simple extension of the above specification is:
$$\ln(x_i) - \ln(x_j) = \beta_{ij} + \sigma (\ln(p_j) - \ln(p_i)) + \gamma_{ij} M/p + \varepsilon, $$
where $p$ denotes a consumer and time specific aggregate price index (over all commodities). Notation $ij$ stands for commodities $i$ and $j$ and not for the observations (I skipped the $n,t$ subscripts for clarity).
This relationship is compatible with nonhomothetic preferences. The homothetic case is obtained for $\gamma_{ij}=0$ which can be tested.
Regarding the computer software... I fully switched to R few years ago, it would &quot;easily&quot; allow to code the minimum distance estimator, and the link between the utility and demand functions.
References:
Diewert, Erwin and Robert Feenstra (2017), “Estimating the Benefits and Costs of New and Disappearing Products,” mimeo, University of California at Davis.
Redding Stephen J and David E Weinstein (2020), &quot;Measuring Aggregate Price Indices with Taste Shocks: Theory and Evidence for CES Preferences,&quot; The Quarterly Journal of Economics, 135, 503-560.
Shimomura, K., 1999, &quot;A simple proof of the Sato proposition on non-homothetic CES functions,&quot; Economic Theory, 14, 501–503.