The slow passage through a homoclinic orbit is analyzed for a periodically forced and weakly damped strongly nonlinear oscillator corresponding to a double-well potential. Multiphase averaging fails at an infinite sequence of subharmonic resonance layers that coalesce on the homoclinic orbit. An accurate phase of the strongly nonlinear oscillator after passage through each subharmonic resonance is obtained using a time shift and a constant phase adjustment. Near the unperturbed homoclinic orbit, the solution is a large sequence of nearly homoclinic orbits in which one saddle approach is mapped into the next. The method of matched asymptotic expansions is used to relate the solution in subharmonic resonance layers to the solution near the unperturbed homoclinic orbit. In this way, we determine an asymptotically accurate analytic description for the boundaries of the basins of attraction corresponding to capture into each well.