Peter needs to end up as one of the Doctor's companions, at least for the length of the storyline, and be trying his hardest to keep his alter-ego a secret. The entire time, the Doctor keeps leading Peter into these dangerous situations, and Peter soon starts thinking that the Doctor knows and that's why he figures Peter can take care of himself. Then at the end the Doctor is like, "Spider-Who?"