Abstract A theory of pairing in weakly bound nuclei is presented. The nucleus is treated as a three-body system consisting of two interacting nucleons together with a structureless core. The pairing interaction is modelled by a density-dependent contact interaction. It is constrained to the free nucleon interaction at low density. Numerically, the Hamiltonian equation is solved by a two-particle Green's function method in coordinate space. Given the single particle resonance energy of 10Li, the theory reproduces the marginal binding of 11Li. The large electric dipole stength in 11Li found experimentally is also accounted for. The nucleus 14Be is also found to be bound.