Why/when do Pokemon run away?
Solution 1:
Your own captured Pokémon will not run away. The only way to lose it is transferring it by accident. Your journal is showing an instance of a wild Ponyta fleeing from battle, which can happen randomly if you fail to capture it too many times, probably more commonly with stronger Pokémon.
A good way to ensure a capture is using better Pokéballs and Razz Berries, but keep in mind that capture attempts can still fail and Pokémon can still flee even when using those items.
Solution 2:
The more CP a Pokémon has the harder it gets to catch it. That Ponyta had 400 CP, which is pretty hard to catch with a simple Pokéball. You'll have to use better Pokéballs and Berries in order to have a good chance of catching a high CP Pokémon.
(There is still no guarantee to actually catch one when using Berries and good Pokéballs, but it will increase the chance significantly.)