In the first Sonic Rivals, press Square while Sonic has his signature move ready and he will fire off a Sonic Boom.
In the sequel the input changes slightly: you tap Square repeatedly to keep the boost going rather than triggering it once. Get into a rhythm and you will hold the speed much longer.