A sealant (such as an anaerobic pipe sealant normally used on threaded joints) may be used in a pinch to pan out some minor scratching on flange faces leading to small but annoying gas leaks beyond the ability of the gasket material to cope with. It's a poor and generally temporary solution and will only work if the sealant is a) compatible with the process fluid b) operating within its design temperature limits and c) the scratching is truly minor.
Some flanges (i.e. not B16.5 pipe flanges) are designed for use of a sealant either alone or in combination with a gasket.
The right solution for a pair of B16.5 flanges of course is to find the right gasket, torque its studs evenly in stages to develop the correct and even tension in the studs to the correct specifications, and if the joint continues to leak, find out why it's leaking and fix it. It could be leaking because of poor gasket surface finish (i.e. like the scratches I was talking about), or poor gasket selection, but for all we know it could be a result of excessive bending forces being applied to the joint etc.- in those cases, sealant will only give you a false sense of security.