Combining our knowledge of halo structure and internal kinematics from cosmological dark matter simulations and the distribution of halo interlopers in projected phase space measured in cosmological galaxy simulations, we develop MAGGIE, a prior-and halo-based, probabilistic, abundance matching (AM) grouping algorithm for doubly complete subsamples (in distance and luminosity) of flux-limited samples. We test MAGGIE-L and MAGGIE-M (in which group masses are derived from AM applied to the group luminosities and stellar masses, respectively) on groups of at least three galaxies extracted from a mock Sloan Digital Sky Survey Legacy redshift survey, incorporating realistic observational errors on galaxy luminosities and stellar masses. In comparison with the optimal Friends-of-Friends (FoF) group finder, groups extracted with MAGGIE are much less likely to be secondary fragments of true groups; in primary fragments, its galaxy memberships (relative to the virial sphere of the realspace group) are much more complete and usually more reliable, and its masses are much less biased and usually with less scatter, as are its group luminosities and stellar masses (computed in MAGGIE using the membership probabilities as weights). FoF outperforms MAGGIE only for high-mass clusters: for the reliability of the galaxy population and the dispersion of its total mass. In comparison with our implementation of the Yang et al. group finder, MAG-GIE reaches much higher completeness and slightly lower group fragmentation and dispersion on group total masses, luminosities and stellar masses, but slightly greater bias in the latter two and lower reliabilities. MAGGIE should therefore lead to sharper trends of environmental effects on galaxies and more accurate mass/orbit modelling.