We consider the asymmetric simple exclusion process (ASEP) on a semi-infinite chain which is coupled at the end to a reservoir with a particle density that changes periodically in time. It is shown that the density profile assumes a time-periodic sawtoothlike shape. This shape does not depend on initial conditions and is found analytically in the hydrodynamic limit. In a finite system, the stationary state is shown to be governed by effective boundary densities and the extremal flux principle. Effective boundary densities are determined numerically via Monte Carlo simulations and compared with those given by mean-field approach and numerical integration of the hydrodynamic limit equation which is the Burgers equation. Our results extend straightforwardly beyond the ASEP to a wide class of driven diffusive systems with one conserved particle species.