Flying animals possess flexible wings that deform during flight. The chordwise flexibility alters the wing shape, affecting the effective angle of attack and hence the surrounding aerodynamics. However, the effects of spanwise flexibility on the locomotion are inadequately understood. Here, we present a two-way coupled aeroelastic model of a plunging spanwise flexible wing. The aerodynamics is modelled with a two-dimensional, unsteady, incompressible potential flow model, evaluated at each spanwise location of the wing. The two-way coupling is realized by considering the transverse displacement as the effective plunge under the dynamic balance of wing inertia, elastic restoring force and aerodynamic force. The thrust is a result of the competition between the enhancement due to wing deformation and induced drag. The results for a purely plunging spanwise flexible wing agree well with experimental and high-fidelity numerical results from the literature. Our analysis suggests that the wing aspect ratio of the abstracted passerine and goose models corresponds to the optimal aeroelastic response, generating the highest thrust while minimizing the power required to flap the wings. At these optimal aspect ratios, the flapping frequency is near the first spanwise natural frequency of the wing, suggesting that these birds may benefit from the resonance to generate thrust.