The most important thing is to be looking directly at them. If your crosshairs are lined up with the circle with the "revive" icon, you'll be much more likely to revive rather than stick to the wall or start sprinting/rolling.
Sometimes though, you'll glitch or you can't quite get lined up. In single player, I tend to just say "aww, forget this" and use Medigel. This isn't so much an option in co-op though. :)
Note also that reviving seems to make you slightly taller than the "low" chest-high cover walls, and that it will also break you out of cover when you finish reviving. Make sure you head for cover immediately afterwards, lest you end up needing first aid yourself. :)