I'd try to have it done before 3 days out if possible. It's really up to the cruise line. If you already have a cabin that sleeps three it should be easy. Good luck!
If you have a cabin that will sleep three and the ship is not full to its coast guard capacity you can add a third person up until 3 days before the ship sails. However, a word from the once burned, Carnival often closes out its 3rd/4th passenger special rates well before this date. At one point we added a daughter who had previously said she didn't want to cruise. On a seven day we paid $409 (1st and 2nd) and $199 for the first child. Two weeks before cruising we paid $589 for the 4th. That was a lesson learned, we won't take that chance again if we can avoid it.
I have a family of 5, so we normally get a triple and a double. Usually we like to get the triple as a balcony cabin and then the double is an inside stateroom across the hall from the balcony cabin. I usually price things out extensively when I book, so that I get the best deal. I like to know the cost differential for having the double on the outside vs. the triple on the outside.
The problem is that usually the cruiseline books all of its cabins at capacity. It is not likely that they will let you book a cabin for 3 with only two people, thereby giving you an opportunity to expand later. At least I have Maybe if you don't have a guarantee cabin, then adding a passenger soon before departure is an option since perhaps they have
If anyone has ever found this last minute "add a passenger" to be a tricky way to end up with an upgraded cabin class, I'd love to hear about it.
I have found Carnival to be slightly price gouging me on the triple. A cruise I am looking at booking has a cruise fare of 839 each for two people in a double balcony cabin. To add a third, the prices are 969, 969, and 489. One way to look at this is a big discount on the third person in the cabin. After all, 489 is way less than 969. But $2427 (=969+969+489) is pretty darn close to the 839 times 3, so there really isn't much discount on the 3rd person.