This work presents a novel framework designed for the management of XR (Extended Reality) services for B5G/6G network paradigms. These networks will enable its near-future deployment to change the concept of the XR experiences known at this moment. Our proposed framework powered by ML (Machine Learning) consists of the measurement and estimation of metrics based on network-accessible information, and a proof of concept of network optimization. The latter is based on the use of KQI (Key Quality Indicators) to tune the performance of XR services. This in conjunction with ML approaches, can offer additional levels of intelligence to networks. To validate this, a 360-video service has been selected as a use case to provide a proof of concept of the performance, utility, and novelty of this work.