This is exactly what I've been dealing with for months! My son is now 14 months and we've been doing the pillow thing too. I've been searching for some kind of roll-off barrier, but there's nothing really out there. So far, he hasn't rolled off, but we do have the bed off the floor with a futon mattress that slides out from underneath. We pull it out when he's on the bed just for extra security. At night if he wakes up he just sleepily rolls around, but for naps he'll just wake up and will start moving a lot so that's when I have to be extra vigilant.
You can start teaching your baby how to get off the to bed on her belly, feet first. 5 months is pretty early to master that skill, but they get it quickly and it makes me feel better knowing that my kid can get off the bed safely, without falling off. Also, they'll do that with stairs too so that's an added bonus!