The problem isn't with the gain of the instruments as such; it's the gain of the instruments, plus the gain of the PA, plus the EQ of the PA versus the room that you're playing in, adding in the position of the instrument and artist.
The solution, then, is not simple, and it isn't an instrument pedal. You need a decent sound engineer :p
Failing that, there are Feedback Suppressors (usually rackmounted) that can listen for feedback and notch out that frequency using a built-in parametric graphic equalizer. These work OK for voice and some guitar work, but their failing is that they sometimes incorrectly hear a long keyboard note (or sustained singing note). When this happens, they think the system is going into feedback, and they notch out that note. It can ruin a song...
The other (best) solution is to ring out the room your playing in. Once you've done it a few times, it becomes a quick process before sound check. But you do need some equipment to do it. Basically, you attempt to identify the frequencies in the room that will cause issues, and you notch them out on EQ.