Shallow gas can cause many disasters, and it is reported in many marine engineering constructions. For this, it is imperative to understand the impact of gas on the mechanical behaviors of soil. This study investigated the influence of undrained triaxial compression tests on dense gassy sand commonly encountered in coastal areas. Triaxial tests were performed on specimens with saturations of 100%, 99.8%, 95.9%, and 92.7% under confining pressures of 50 kPa and 200 kPa by a self-developed multi-purpose integrated triaxial apparatus (MITA) for gassy soil. The results are presented in terms of monotonic stress‒strain behavior, volumetric behavior, shear strength, and excess pore water pressure (EPWP). The occurrence of gas bubbles has different effects on loose and dense sands, augmenting the undrained shear strength of loose sand while concurrently diminishing that of dense sand. The deviatoric stress of dense sand increases during shear shrinkage, which is similar to the characteristics of loose sand under the influence of gas bubbles. However, following sand dilation, the effect of gas bubbles on deviatoric stress manifests in an antithetical manner. With elevated gas content, the shear strength of dense sand decreases, accompanied by a deceleration in the development of EPWP and a notable increase in volumetric changes. To this end, a microscopic explanation concerning the deformation and evolution of gas bubbles within sand during the shear process was presented to reveal the macroscopic laws governing the undrained shear attributes of dense gassy sand.