  Bound states in the continuum (BICs) theoretically have the ability to
confine electromagnetic waves in limited regions with infinite radiative
quality ($Q$) factors. However, in practical experiments, resonances can only
exhibit finite $Q$ factors due to unwanted scattering losses caused by
fabrication imperfections. Recently, it has been shown that ultrahigh-$Q$
guided-mode resonances (GMRs), which are robust to fabrication imperfections,
can be realized by merging multiple BICs in momentum space. In this study, we
analytically and numerically investigate the merging and band transition of
accidental BICs in planar photonic lattices. Accidental BICs can merge at the
edges of the second stop band, either with or without a symmetry-protected BIC.
We show that as the thickness of the photonic lattice gradually increases, the
merged state of BICs transitions from the upper to the lower band edge. Using
coupled-mode analysis, we present the analytical merging thickness at which
multiple accidental BICs merge at the second-order $\Gamma$ point. Our
coupled-mode analysis could be beneficial for achieving ultrahigh-$Q$ GMRs in
various photonic lattices composed of materials with different dielectric
constants.
