We developed a method for estimating the boundary shape of a basin structure using seismograms observed on the surface. With this waveform inversion scheme, an accurate estimation is possible with data from a few surface stations, because seismic waves are affected not only by the local structure beneath the observation station but also by the entire basin structure. Numerical experiments were successfully carried out to determine the boundary shapes from observed surface records for a two-dimensional SH problem. For simplicity, only the boundary shape, that is thickness variations in the sedimental layer, was used as model parameters. This nonlinear problem is solved iteratively. To avoid the instabilities resulting from inappropriate initial models or from a large number of parameters, a hierarchical method, in which the number of parameters are increased gradually, is developed. We also successfully performed the inversions when the given parameters contain some errors and when the data contain noise.