  We present Chandra and VLA observations of GW170817 at ~521-743 days post
merger, and a homogeneous analysis of the entire Chandra data set. We find that
the late-time non-thermal emission follows the expected evolution from an
off-axis relativistic jet, with a steep temporal decay $F_{\nu}\propto
t^{-1.95\pm0.15}$ and a simple power-law spectrum $F_{\nu}\propto
\nu^{-0.575\pm0.007}$. We present a new method to constrain the merger
environment density based on diffuse X-ray emission from hot plasma in the host
galaxy and we find $n\le 9.6 \times 10^{-3}\,\rm{cm^{-3}}$. This measurement is
independent from inferences based on the jet afterglow modeling and allows us
to partially solve for model degeneracies. The updated best-fitting model
parameters with this density constraint are a fireball kinetic energy $E_0 =
1.5_{-1.1}^{+3.6}\times 10^{49}\,\rm{erg}$ ($E_{iso}=
2.1_{-1.5}^{+6.4}\times10^{52}\, \rm{erg}$), jet opening angle $\theta_{0}=
5.9^{+1.0}_{-0.7}\,\rm{deg}$ with characteristic Lorentz factor $\Gamma_j =
163_{-43}^{+23}$, expanding in a low-density medium with $n_0 =
2.5_{-1.9}^{+4.1} \times 10^{-3}\, \rm{cm^{-3}}$ and viewed $\theta_{obs} =
30.4^{+4.0}_{-3.4}\, \rm{deg}$ off-axis. The synchrotron emission originates
from a power-law distribution of electrons with $p=2.15^{+0.01}_{-0.02}$. The
shock microphysics parameters are constrained to $\epsilon_{\rm{e}} =
0.18_{-0.13}^{+0.30}$ and $\epsilon_{\rm{B}}=2.3_{-2.2}^{+16.0} \times
10^{-3}$. We investigate the presence of X-ray flares and find no statistically
significant evidence of $\ge2.5\sigma$ of temporal variability at any time.
Finally, we use our observations to constrain the properties of synchrotron
emission from the deceleration of the fastest kilonova ejecta with energy
$E_k^{KN}\propto (\Gamma\beta)^{-\alpha}$ into the environment, finding that
shallow stratification indexes $\alpha\le6$ are disfavored.
