i have a pair of black ray gobies in a four gallon vase. 9" inches diameter, 19 1/2" tall.
no lid. 5" sandbed with randalls pistol, tunnels everywhere. they dart into their tunnels when they're frightened. i only see the male after they release their larvae, once a week... had them in there almost two years.
i think the trick to keeping gobies from jumping is to pair them with a shrimp, give them a deep sand bed to tunnel into and overhangs to prevent them from making it to the surface. a deep tank also helps.