This works for me:
1. Perform a proper warm-up. Mine is about 10 minutes long. It looks a lot like this warm up from Crossfit.
(.wmv video file)
2. I also add Shoulder Dislocations
to my warm-up, 3 sets of 10 with a 1" PVC pipe although I sometimes use a jump rope too. I had developed shoulder pain before and since I've added this exercise to my warm-up it hasn't come back.
3. Focus on keeping the elbows in towards your sides on push-ups.
4. When doing pull-ups, don't let your shoulder girdle becomes "loose" keep your shoulders back by tightening that shoulder girdle and don't let the shoulders come forward during the pull-up, lead with the upper chest.
I'm sure there are other tips but these are what helped me out with my shoulder pain. Also, don't be afraid to take a day off if the pain is persistent. I took about a week off, incorporated these tips and then went back at it with no pain.