All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
If you are doing that with a correct intention, like if you do so in order that your prayer be more beloved to Allaah than his prayer, or to attain a greater reward than the reward for his prayer, then you will be rewarded, Allaah willing, for this competing, and Allaah says about obtaining the bliss of the Hereafter (what means): {So for this let the competitors compete.} [Quran 83:26]. It means, let the people do their best and compete in achieving this, and they should have the eager desire within themselves, and competitors should compete for such a thing.
However, if you do that without a correct intention, such as if you do that because you know that that person is watching what you are doing, then this is Riyaa' (ostentation) which necessarily involves sin. For information on the kinds of Riyaa' and the warning against it, please refer to Fatwa 92308.
Allaah Knows best.