That is a good question.
In endgames such as the one you described (not when you have opposite color bishops, and not when your opponent has a bishop pair), there is a clear answer. It is almost always better to have your pawns on the opposite color of your opponent's bishop (so if he has a light bishop, have your pawns on dark squares). In fact, that often leads to a winning advantage. The are many reasons why this is so. First of all, like you said, your pawns are immune to attack by his bishop, and they do not limit your own bishop's movement. Second, if his pawns are locked on the same color of his bishop, you can attack them with your bishop, while they limit his own bishop's movement. Third, the bishop's biggest flaw is that it's limited to one color. having your pawns on the opposite color gives you more versatility in that sense, while at the same time exploiting your opponent's weak squares which he cannot defend with his bishop and you can further exploit with your king.
Note! this also strongly applies when you have a knight (and to a lesser extent, a rook) vs. a bishop - recently I saw a very good article demonstrating this, but I cannot find it anymore!
As far as the middle game is concerned, it depends on the situation. It could be a good advantage if your pawns are on the same color of your opponent's bishop, hindering it's movement. I believe though that it could even be better if his own pawns are locked on the same color of his bishop.
Let's say in an end game, my opponent and I have equal pawns and same colored (say a light) bishop. Is it better for me to put my pawns on light squares (in order to block my opponents bishop but it can put my pawns under treat) or should I put my pawns on dark sqaures (so they can't be threatened but may hold up my bishop)? Or maybe it's 50-50. This could also apply to a middle game. Would it be the same there?