Massaging them is fine; try to go in the direction of the muscle fibers, rather than across them.
However...
If your stretching is painful, you are overstretching. You should push to the point where you feel a good stretch, then stop. Hold the stretch. After a few seconds, you'll feel the muscle release bit by bit, and you'll be able to go further into the stretch comfortably. If you're pushing to the point of pain, you are injuring the muscle, and that will result in decreased flexibility over time.
You can also try a technique called CRAC stretching. (A horrible acronym that stands for contract-relax-agonist-contract)
- Go into your normal stretch. Once you've attained a good stretch, contract the muscle that you're stretching. Hold for 7-15 seconds, then release.
- Hold the passive stretch for a few more seconds.
- Next, contract the muscle that does the opposite of the muscle you're stretching. For example, if you're stretching the quads, contract the hamstrings. Hold 7-15 seconds, then relax.
- Continue your stretch for several more seconds. You should see an increase in ROM after each step.
Good luck.