How can I pull/push a PVC pipe closer to the wall?
You could use plumbers tape to try and restrain the pipe but if the force required to move the pipe is significant and you already have the wall torn open you might want to just fir that wall out before reapplying your drywall. 

After seeing the picture you will probably want to just drywall around the protruding bit, which is almost certainly a clean-out. It's bad karma to bury them anyway and there are these sharp looking clean out covers made specifically for the job. It will save you miles of heart ache.