File w/ many line pairs--how do I order based on 1st lines only?

I have a file in which the data is stored in pairs of lines. The first line (beginining with ">") is a header, the second line is a sequence.

I would like to sort the file by species name. Desired output for the example file:

I can use

sort -t'_' -k2

to alphabetize headers in the correct way, but I'm not sure how to bring the sequences (second lines of each pair) along for the ride. Can anyone help?

$ 
$ cat f03
>gi|31425523|gb|AY987736.1|_Macrosiphum_rosae
TCCGTGGAGATGCACCACGAAGCT
>gi|512740870|gb|JX507490.1|_Macrosiphum_funestum
GTCGTGTAGAAA-CTGGTCTT
>gi|336390332|gb|HQ651228.1|_Cryptomyzus_maudamanti
GTTTTCGCACCAGCA
>gi|0|mcg|0|_Aulacorthum_albimagnoliae
A-GTCAGCAGTTAC
$ 
$ 
$ perl -ne '/^>.*?_(.*)$/; $x{$1}.=$_ }{ foreach $k (sort keys %x){print $x{$k}}' f03
>gi|0|mcg|0|_Aulacorthum_albimagnoliae
A-GTCAGCAGTTAC
>gi|336390332|gb|HQ651228.1|_Cryptomyzus_maudamanti
GTTTTCGCACCAGCA
>gi|512740870|gb|JX507490.1|_Macrosiphum_funestum
GTCGTGTAGAAA-CTGGTCTT
>gi|31425523|gb|AY987736.1|_Macrosiphum_rosae
TCCGTGGAGATGCACCACGAAGCT
$ 
$ 
1 Like