  The DistFlow model accurately represents power flows in distribution systems,
but the model's nonlinearities result in computational challenges for many
applications. Accordingly, a linear approximation known as \mbox{LinDistFlow}
(and its three-phase extension LinDist3Flow) is commonly employed. This paper
introduces a parameter optimization algorithm for enhancing the accuracy of
this approximation for both balanced single-phase equivalent and unbalanced
three-phase distribution network models, with the goal of aligning the outputs
more closely with those from the nonlinear DistFlow model. Using sensitivity
information, our algorithm optimizes the LinDistFlow approximation's
coefficient and bias parameters to minimize discrepancies in predictions of
voltage magnitudes relative to the nonlinear DistFlow model. The parameter
optimization algorithm employs the Truncated Newton Conjugate-Gradient (TNC)
method to fine-tune coefficients and bias parameters during an offline training
phase to improve the LinDistFlow approximation's accuracy. % in optimization
applications. Numerical results underscore the algorithm's efficacy, showcasing
accuracy improvements in $L_{1}$-norm and $L_{\infty}$-norm losses of up to
$92\%$ and $88\%$, respectively, relative to the traditional LinDistFlow model.
We also assess how the optimized parameters perform under changes in the
network topology and demonstrate the optimized LinDistFlow approximation's
efficacy in a hosting capacity optimization problem.
