  The relativistic double neutron star binary PSR J0737-3039 shows clear
evidence of orbital phase-dependent wind-companion interaction, both in radio
and X-rays. In this paper we present the results of timing analysis of PSR
J0737-3039 performed during 2006 and 2011 XMM-Newton Large Programs that
collected ~20,000 X-ray counts from the system. We detected pulsations from PSR
J0737-3039A (PSR A) through the most accurate timing measurement obtained by
XMM-Newton so far, the spin period error being of 2x10^-13 s. PSR A's pulse
profile in X-rays is very stable despite significant relativistic spin
precession that occurred within the time span of observations. This yields a
constraint on the misalignment between the spin axis and the orbital momentum
axis Delta_A ~6.6^{+1.3}_{-5.4} deg, consistent with estimates based on radio
data. We confirmed pulsed emission from PSR J0737-3039B (PSR B) in X-rays even
after its disappearance in radio. The unusual phenomenology of PSR B's X-ray
emission includes orbital pulsed flux and profile variations as well as a loss
of pulsar phase coherence on time scales of years. We hypothesize that this is
due to the interaction of PSR A's wind with PSR B's magnetosphere and
orbital-dependent penetration of the wind plasma onto PSR B closed field lines.
Finally, the analysis of the full XMM-Newton dataset provided evidences of
orbital flux variability (~7%) for the first time, involving a bow-shock
scenario between PSR A's wind and PSR B's magnetosphere.
