A precise understanding of mechanisms governing the dynamics of electrons in atoms and molecules subjected to intense laser fields has a key importance for the description of attosecond processes such as the high-harmonic generation and ionization. From the theoretical point of view, this is still a challenging task, as new approaches to solve the time-dependent Schrödinger equation with both good accuracy and efficiency are still emerging. Until recently, the purely numerical methods of real-time propagation of the wavefunction using finite grids have been frequently and successfully used to capture the electron dynamics in small one- or two-electron systems. However, as the main focus of attoscience shifts toward many-electron systems, such techniques are no longer effective and need to be replaced by more approximate but computationally efficient ones. In this paper, we explore the increasingly popular method of expanding the wavefunction of the examined system into a linear combination of atomic orbitals and present a novel systematic scheme for constructing an optimal Gaussian basis set suitable for the description of excited and continuum atomic or molecular states. We analyze the performance of the proposed basis sets by carrying out a series of time-dependent configuration interaction calculations for the hydrogen atom in fields of intensity varying from 5 × 1013 W/cm2 to 5 × 1014 W/cm2. We also compare the results with the data obtained using Gaussian basis sets proposed previously by other authors.