Here, we report on simultaneous X-ray and radio observations of the radio-mode-switching pulsar PSR B1822?09 with ESA's <
i>
XMM?Newton<
/i>
and the Westerbork Synthesis Radio Telescope, Giant Metrewave Radio Telescope and Lovell radio telescopes. PSR B1822?09 switches between a radio-bright and radio-quiet mode, and we discovered a relationship between the durations of its modes and a known underlying radio-modulation time-scale within the modes. We discovered X-ray (energies 0.2?1.4 keV) pulsations with a broad sinusoidal pulse, slightly lagging the radio main pulse in phase by 0.094 � 0.017, with an energy-dependent pulsed fraction varying from ~0.15 at 0.3 keV to ~0.6 at 1 keV. No evidence is found for simultaneous X-ray and radio mode switching. The total X-ray spectrum consists of a cool component (T ~0.96 � 10<
sup>
6<
/sup>
K, hotspot radius R ~2.0 km) and a hot component (T ~2.2 � 10<
sup>
6<
/sup>
K, R ~100 m). The hot component can be ascribed to the pulsed emission and the cool component to the unpulsed emission. The high-energy characteristics of PSR B1822?09 resemble those of middle-aged pulsars such as PSR B0656+14, PSR B1055?52 and Geminga, including an indication for pulsed high-energy gamma-ray emission in <
i>
Fermi<
/i>
Large Area Telescope data. Explanations for the high pulsed fraction seem to require different temperatures at the two poles of this orthogonal rotator, or magnetic anisotropic beaming effects in its strong magnetic field. In our X-ray skymap, we found a harder source at only 5.1 � 0.5 arcsec from PSR B1822?09, which might be a pulsar wind nebula.