The first mistake u r doing is that running 300+ tests for 5hrs
why cant u split those tests into multiple threads(sessions) and make them to execute in less than 15mins
If there are random failures for a particular test means u may ignore
Try to execute the scripts 3 to 5 times in your local machine before deployment, so that we can cum to a assurance that at 9 out of 10 times will have success rate.