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.
The question is somewhat ambiguous. It is possible to perform four Rakʻahs as Sunnah (voluntary prayer) after performing the Fardh (obligatory prayer) in case of the Thuhr prayer. Umm Habeebah narrated that the Prophet said: “Whoever performs four Rakʻahs before Thuhr prayer and four after it, Allaah forbids his flesh from Hellfire.” [Ahmad and An-Nasaa’i in As-Sunan Al-Kubra]
Regarding the validity of your prayer because she performed four Rakʻahs as Sunnah after the Fardh, you should know that the validity of your prayer has nothing to do with hers as long as you performed the Fardh and finished it properly. In this case, your prayer is valid, whether she has performed two or four Rakʻahs as Sunnah or did not perform any after the Fardh.
Also, if you mean that you performed the Fardh behind your friend while she was performing a Sunnah prayer, your prayer is valid as well and there is no problem with that according to the opinion adopted on Islamweb.
Allaah Knows best.