In the study of the proper homotopy theory of finitely presented groups, semistability at infinity is an end invariant of central importance. A finitely presented group that is semistable at infinity has a well-defined fundamental group at infinity independent of base ray. If $G$ is semistable at infinity, then $G$ has free abelian second cohomology with ${\mathbb Z}G$ coefficients. In this work, the authors show that amalgamated products and HNN-extensions of finitely presented semistable at infinity groups are also semistable at infinity. A major step toward determining whether all finitely presented groups are semistable at infinity, this result easily generalizes to finite graphs of groups. In an early application, this result was used in showing that all one-relator groups are semistable at infinity. The theory of group actions on trees and techniques derived from the proof of Dunwoody's accessibility theorem are key ingredients in this work.