The "two" or "three" here echoes the earlier verse, Matthew 18:16, and may refer to the same people.
The "in my name" here is different than the more common way that Jesus says "in my name," having a different preposition and following word form. To distinguish this phrase, it would be better translated as "for my name" or "for honoring my name." See this article for more.
Christ's Words in Matthew as a Guide to 40 Days of Prayer.