Context : Aims : We aim to study the large-scale structure of an extragalactic serendipitous X-ray survey with unprecedented accuracy thanks to the large statistics involved , and provide insight into the environment of AGN at the epochs when their space density declines ( z \sim 1 - 2 ) . Methods : In this paper we present the two-point angular correlation function of the X-ray source population of 1063 XMM-Newton observations at high Galactic latitudes , comprising up to \sim 30000 sources over a sky area of \sim 125.5 deg ^ { 2 } , in three energy bands : 0.5-2 ( soft ) , 2-10 ( hard ) , and 4.5-10 ( ultrahard ) keV . This is the largest survey of serendipitous X-ray sources ever used for clustering analysis . Results : We have measured the angular clustering of our survey and find significant positive clustering signals in the soft and hard bands ( \sim 10 \sigma and \sim 5 \sigma , respectively ) , and a marginal clustering detection in the ultrahard band ( < 1 \sigma ) . We find dependency of the clustering strength on the flux limit and no significant differences in the clustering properties between sources with high hardness ratios ( and therefore likely to be obscured AGN ) and those with low hardness ratios . We deprojected the angular clustering parameters via Limber ’ s equation to compute their typical spatial lengths . From that we have inferred that AGN at redshifts of \sim 1 are embedded in dark matter haloes with typical masses of \langle \log M _ { DMH } \rangle \simeq 12.60 \pm 0.34 h ^ { -1 } M _ { \odot } and lifetimes of t _ { AGN } = 3.1 - 4.5 \times 10 ^ { 8 } yr . Conclusions : Our results show that obscured and unobscured objects share similar clustering properties and therefore they both reside in similar environments , in agreement with the unified model of AGN . The short AGN lifetimes derived suggest that AGN activity might be a transient phase that can be experienced several times by a large fraction of galaxies throughout their lives .