We derive an approximate analytical expression of the maximum mass of relativistic self-gravitating Bose-Einstein condensates with repulsive or attractive $|\ensuremath{\varphi}{|}^{4}$ self-interaction. This expression interpolates between the general relativistic maximum mass of noninteracting bosons stars, the general relativistic maximum mass of bosons stars with a repulsive self-interaction in the Thomas-Fermi limit, and the Newtonian maximum mass of dilute axion stars with an attractive self-interaction [P. H. Chavanis, Phys. Rev. D 84, 043531 (2011)]. We obtain the general structure of our formula from simple considerations and determine the numerical coefficients in order to recover the exact asymptotic expressions of the maximum mass in particular limits. As a result, our formula should provide a relevant approximation of the maximum mass of relativistic boson stars for any value (positive and negative) of the self-interaction parameter. We discuss the evolution of the system above the maximum mass and consider application of our results to dark matter halos and inflaton clusters. We also make a short review of boson stars and Bose-Einstein condensate dark matter halos and point out analogies with models of extended elementary particles.