Long-time existence for small amplitude semilinear wave equations