22 Accordingly, Matthew proceeds as follows: “Now Peter sat without in the palace; and a damsel came unto him, saying, Thou also wast with Jesus of Galilee. But he denied before them all, saying, I know not what you say. And as he went out into the porch, another maid saw him, and said unto them that were there, This fellow was also with Jesus of Nazareth. And again he denied with an oath, I do not know the man. And after a while came unto him they that stood by, and said to Peter, Surely you also are one of them, for your speech betrays you. Then began he to curse and to swear, saying that he knew not the man. And immediately the cock crew.” Such is Matthew's version. But we are also given to understand that after he had gone outside, and when he had now denied the Lord once, the first cock crew—a fact which Matthew does not specify, but which is intimated by Mark.
Source: The Harmony of the Gospels (New Advent)