My name isXXXXX a registered nurse with many years of clinical experience. I very much appreciate your patronage and am glad to try and help out.
Here's how this works. You ask the right question when you query about which man is "more likely" the father. In other words, one can't say with absolute precision absent genetic testing if and when the time comes. But, what certainly can be said is that out of the two men and two sexual encounters you've described, the most likely putative father is the first man, the one who ejaculated in the woman. Of course, coitus interruptus ("withdrawal method") is notoriously unreliable and pregnancy can certainly still result. Nevertheless, indeed the most likely man in this case would be the first scenario you've described here given the pregnancy test and sonogram results.
If you have a follow-up question or need clarification, please just say the word by using "reply" to reach me.
I truly hope all works out for you.