Okay. First off - DON'T WORRY!
You are still young, and growing up. Like I have said several times over the past few weeks, during puberty your hormones are crazy!, causing your body to become confused with all the different signals and messages. Basically, some peoples sexuality gets a little confused, and they start thinking about the same gender etc.
Trust me, it is a very common and normal thing for guys to start thinking about other boys in a sexual way during puberty, even whilst they are going out with something.
However, you did what could be classed as 'experimenting', where you experimented sexually with another boy to see if you perhaps enjoyed it.
Now, you need to really have a think and see whether you liked it or not, and the thing is you most probably did, as would a lot of people who just havn't tried it. (Think about it, you didn't like chocolate till you tried it did you? ;])
The best way to solve this, is just let puberty take it's course. Your friend is probably in the same position as you, thinking hes just a bit confused. Don't go announcing your gay etc. as it may just be a phase your going through like I said, so wait until your much older and then see what your into.
However, what you did was wrong, as you were having sexual contact behind both of your girlfriends backs. If this boy thinks hes gay, and he has tried to do things with you several times, he needs to tell his girlfriend as it is completely unfair to her.
You, yourself need to decide what you want for now. If you think it will happen again between you, I suggest finishing with your girlfriend - otherwise she will just find out in the long run, and it'll all be worse off.
Good luck, and if you have any further questions etc. please feel free to PM me! :]