I usually speed up to pass unless I'm already going a lot faster than the bike I'm approaching. I do this because passing usually entails leaving the bike lane and entering the lane of traffic or crossing into the oncoming lane of a MUP. I then slow back to the pace I was riding after the pass.
If I am passed, I often find myself matching that person's pace unless they are really flying. This happens a lot when I'm riding with my wife (who rides at a slower pace than I typically do) until I look back to see I've dropped her.
As for speeding up to prevent a pass, if anything, I will slow or pull to the right to make it easier for a faster rider to pass.