Because vascular endothelial growth factor inhibition has been suggested to improve immune cell function in the cancer microenvironment, we examined whether using ramucirumab (RAM) before nivolumab usage is more effective in advanced gastric cancer. This was a multicenter retrospective observational study. We analyzed patients who received nivolumab monotherapy as the third-line regimen for unresectable advanced or recurrent gastric cancer between October 2017 and December 2022. They were divided into the RAM (RAM-treated) group and the non-RAM (non-treated) group according to the RAM usage in the second-line regimen. The primary outcome was to compare the overall survival after nivolumab administration in the third-line regimen between the RAM and non-RAM groups. Fifty-two patients were included in the present study: 42 patients in the RAM group and ten patients in the non-RAM group. The median overall survival was significantly longer in the RAM group than in the non-RAM group (8.5months vs 6.9months, p<0.05). In the RAM group, patients without peritoneal metastasis had significantly better median overall survival than those with peritoneal metastasis (23.8months vs 7.7months, p=0.0033). Multivariate Cox-proportional hazards analyses showed that the presence of peritoneal metastasis (hazard ratio, 2.4; 95% confidence interval 1.0-5.7) alone was significantly associated with overall survival in the RAM group. The use of RAM prior to nivolumab monotherapy may contribute to prolonged survival in patients with gastric cancer, especially those without peritoneal metastasis.