Probably not. At least, not for long. In fact, if Peter stayed in John's company at all, I think the Gospels give us plenty of reasons to doubt that it could have been much more than a week or two. In the simplest terms, here's why:
We know Peter & Andrew shared a home. We don't know if other adult males were involved in that household, but we do know somebody had to provide food for a large family there. And Andrew is the one who appears to have been with the Baptizer for some time. But let's hold on comparing the brothers for just a moment.
More generally, the Gospels give us a broadly consistent view of Peter that suggests he was far more likely to be found fishing than to be long-suffering in prayer. But, and this goes especially more to the point, apart from miraculous catches of fish (or wealthy women providing for peoples' needs), we just don't see Peter leaving his family to travel with Jesus. At least, not for very long stretches.
First, upon leaving Jesus in Samaria, Peter had only been gone for some weeks. Lastly, upon leaving his post-Easter devotionals in the [surely] 'presence-practicing' upper room, it had been at least eight and some days after Easter. By that point, the days of unleavened bread were gone, meaning Peter left Jerusalem not too long after it became non-conspicuous for him to be doing so. In other words, he didn't over-linger. Sure Jesus' Spirit was in them, but hey! People still had to eat.
At another point, this also happened: IF the Gospel narrative sections from Mark 1:16-38 and Luke 4:31-5:11 are both chronologically sequenced, and if they can be 'harmonized', so to speak, then it appears Peter here refused a one-on-one invitation to travel with Jesus again. To explain this point in more detail, putting Mark's v.36-39 into Luke 4:42-44 adds specific color to Peter's "sinful man" confession. It also helps explain why Jesus needed to pull up all those fish. Simon's chief concern? Hey! He might be the Messiah, but people still had to eat.
But now let's get back to that household, which was probably in Capernaum, even though Peter may himself have originally been from Bethsaida. But that's all by the by.
The question at hand is - Did Peter follow John the Baptist? And I say the answer to that is quite simple. If Peter left home, who else would provide for that household? The fact that Peter's mother-in-law lived there, as did Peter's wife (assuming the MIL's daughter is the same wife Peter took to Corinth, twenty-something years later) - that, combined with his staunch work ethic, as detailed above - makes Peter the most likely candidate to be acting head of the family home. And that means, Peter likely did not leave them for long stretches, if at all.
To be fair, we don't know that Andrew wasn't married. Maybe he was. For all we know, Peter and Andrew could even have taken shifts following John. But I don't think they did.
What I do think is this. If we conclude from the Gospels that Andrew had been John's disciple at some length, then we should NOT take the family connection as support for a view that Peter probably was also. If anything, the family connection makes it most likely that if Andrew had left home for a long time to follow the Baptizer... then Peter had not.