  Solitary waves in one-dimensional periodic media are discussed employing the
nonlinear Schr\"odinger equation with a spatially periodic potential as a
model. This equation admits two families of gap solitons that bifurcate from
the edges of Bloch bands in the linear wave spectrum. These fundamental
solitons may be positioned only at specific locations relative to the
potential; otherwise, they become nonlocal owing to the presence of growing
tails of exponentially-small amplitude with respect to the wave peak amplitude.
Here, by matching the tails of such nonlocal solitary waves, higher-order
locally confined gap solitons, or bound states, are constructed. Details are
worked out for bound states comprising two nonlocal solitary waves in the
presence of a sinusoidal potential. A countable set of bound-state families,
characterized by the separation distance of the two solitary waves, is found,
and each family features three distinct solution branches that bifurcate near
Bloch-band edges at small, but finite, amplitude. Power curves associated with
these solution branches are computed asymptotically for large solitary-wave
separation, and the theoretical predictions are consistent with numerical
results.
