One way to do it (there are many) is to have a horse tied right outside the barn. Bring your mare into the barn, pause for just a second, and walk her out. Do this again and again and again. Eventually, your mare will be tired of getting hyped and calming down and than getting hyped again. She'll know she'll see her friend in a short amount of time anyway.
Gradually increase the amount of time she spends inside the barn alone. When you first start, she might not be able to stand there for 30 seconds. Make her stand for 25 and then walk her out to see her friend. Never increase the time to the point she gets worried and then
you bring her to see her friend. Bring her back out right before she starts to act out.
This way will take time and effort, but it really increases confidence.