For my PhD, should I go with the more prestigious university, or the one that is a better research match?
If you want to stay in academia, your top priority should be producing excellent research.  From your post, it sounds like this will be possible at either university.  Another helpful factor is your academic advisor.  Ideally, you can study under a very famous/well-respected/talented person.  Again it sounds like you have two good options in this regard.
If I may, it sounds like you have two good options.  This is a positive to me in that you cannot 'screw it up' and make the wrong choice.  One piece of advice is to consider the process of obtaining your degree rather than what happens when you're done.  You're looking at years of effort, so why not try to enjoy/maximize it instead of fretting about ultimate placement?  Live 'in the moment', as the millennials like to say.
A last cliche bit of advice is to flip a coin.  Heads = A, Tails = B.  Once you see the coin land, you'll either feel a quick sense of glee or sting of disappointment.  Then ignore the coin result and pick based on this feeling.  Good luck!