Observation time is the key parameter for improving the precision of measurements of gravitational quantum states of particles levitating above a reflecting surface. We propose a new method of long confinement in such states of atoms, anti-atoms, neutrons and other particles possessing a magnetic moment. The Earth gravitational field and a reflecting mirror confine particles in the vertical direction. The magnetic field originating from electric current passing through a vertical wire confines particles in the radial direction. Under appropriate conditions, motions along these two directions are decoupled to a high degree. We estimate characteristic parameters of the problem, and list possible systematic effects that limit storage times due to the coupling of the two motions. In the limit of low particle velocities and magnetic fields, precise control of the particle motion and long storage times in the trap can provide ideal conditions for both gravitational, optical and hyperfine spectroscopy: for the sensitive verification of the equivalence principle for antihydrogen atoms; for increasing the accuracy of optical and hyperfine spectroscopy of atoms and antiatoms; for improving constraints on extra fundamental interactions from experiments with neutrons, atoms and antiatoms.