Although secondary ion mass spectrometry (SIMS) is a versatile method used in the fields of surface analysis, depth profiling and elemental and molecular mapping, it also lacks quantification capabilities. The main reason for this is the matrix effect, which influences the ionization yield of secondary ions with respect to the substrate from which the analyzed compounds originate. There are several approaches to reduce the matrix effect, and gas flooding is one of the easiest methods to apply. In this work, we have investigated the possibilities of the ToF-SIMS method for the quantification of selected metals and alloys containing these metals in different ratios by reducing the matrix effect in the presence of different atmospheres. The measurements were performed in the ultra-high vacuum (UHV) environment, H2 and O2 atmospheres. H2 flooding shows the most significant improvements compared to the UHV analysis, while O2 is also promising but has some limitations. Improvements are most evident for the transition metals Ti, Cr, Fe, Co and Ni employed in our study, while the p-block elements such as Al and Si do not change so extensively. The deviations from the true atomic ratios of selected transition metals in different alloys reach a maximum of only 46 % when analyzed in the H2 atmosphere. In contrast, these values are 66 and 228 % for the O2 atmosphere and UHV environment, respectively. Our results suggest that gas adsorption and consequent formation of a new matrix on the surface, especially in the case of hydrogen, reduces the differences between the different chemical environments and electronic structures of the surface. In this way, the quantitative aspects of the SIMS method can be improved.