We present our determination of the baryon budget for an X-ray-selected XXL sample of 136 galaxy groups and clusters spanning nearly two orders of magnitude in mass (M 500 ∼ 10 13 − 10 15 M ) and the redshift range 0 < ∼ z < ∼ 1. Our joint analysis is based on the combination of HSC-SSP weak-lensing mass measurements, XXL X-ray gas mass measurements, and HSC and SDSS multiband photometry. We carry out a Bayesian analysis of multivariate mass-scaling relations of gas mass, galaxy stellar mass, stellar mass of brightest cluster galaxies (BCGs), and soft-band X-ray luminosity, by taking into account the intrinsic covariance between cluster properties, selection effect, weak-lensing mass calibration, and observational error covariance matrix. The mass-dependent slope of the gas mass-total mass (M 500 ) relation is found to be 1.29 +0.16 −0.10 , which is steeper than the self-similar prediction of unity, whereas the slope of the stellar mass-total mass relation is shallower than unity, 0.85 +0.12 −0.09 . The BCG stellar mass weakly depends on cluster mass with a slope of 0.49 +0.11 −0.10 . The baryon, gas mass, and stellar mass fractions as a function of M 500 agree with the results from numerical simulations and previous observations. We successfully constrain the full intrinsic covariance of the baryonic contents. The BCG stellar mass shows the larger intrinsic scatter at a given halo total mass, followed in order by stellar mass and gas mass. We find a significant positive intrinsic correlation coefficient between total (and satellite) stellar mass and BCG stellar mass and no evidence for intrinsic correlation between gas mass and stellar mass. All the baryonic components show no redshift evolution.