Once I was in a congregational prayer when the person next to me pulled me toward him to fill a gap in the line, but my concentration was disturbed. To my knowledge when one is praying he should behave as one standing in front of God who is watching him. Is the action done acceptable?

You are right and the person who pulled you to fill the gap is right as well. It is true that when we are engaged in prayer, we should be fully concentrating on the task at hand, realizing that we are standing in front of God, addressing Him and He is listening to us. Therefore, our concentration on prayer should be at its highest. However, when we are in congregational prayer, we should also make sure that we stand in lines as we have been taught by the Prophet, peace be upon him.

Each line starts exactly behind the imam who should always be kept in the middle. This means that people should stand either to the right or the left of the center point leaving no gaps between them. They can ensure that by standing shoulder to shoulder in straight lines. If there is a gap in a line, the person next to it should move to fill it, making sure that the one who moves is the one whose movement is toward the center. If you see a gap in the line in front of you, you should move up to fill it. At no time gaps may be left in the lines. If you make such a move, you are able to regain concentration easily.