The initial boundary-value problem associated to a semilinear wave equation with time-dependent boundary values was approximated by using the method of lines. Time integration is achieved by means of an explicit time method obtained from an arbitrarily high-order splitting scheme. We propose a technique to incorporate the boundary values that is more accurate than the one obtained in the standard way, which is clearly seen in the numerical experiments. We prove the consistency and convergence, with the same order of the splitting method, of the full discretization carried out with this technique. Although we performed mathematical analysis under the hypothesis that the source term was Lipschitz-continuous, numerical experiments show that this technique works in more general cases.