Can anyone suggest a better ending for "The Gift of the Magi"?
With all due respect, your question indicates that perhaps you need to review the ending of this excellent story to try and understand what the author achieved by giving it this ending and how it links in to the theme of the story. Of course, the ending isn't what we expect, and yet this is precisely what is so great about the ending. O. Henry uses situational irony, or things turning out to be the opposite of how we expect them to be, to highlight the kind of love that Jim and Della have for each other. Note what the author says about these two lovers in the final paragraph of the story:
But in a last word to the wise of these days, let it be said that of all who have gifts, these two were the wisest. Of all who give and receive gifts, such as they are the wisest. Everywhere they are wisest. They are the Magi.
The unconventional ending therefore is so successful precisely because Jim and Della capture the original sacrificial spirit of gift giving that the Magi demonstrated. They both sacrified their dearest possession to buy a present fitting for their loved one. Although this made them "foolish children" who sacrified "the greatest treasures of their house," the fact that they did this for love of one another makes them worthy successors of the original Magi and helps us to remember why and how we should give gifts. Therefore there shouldn't be any other ending to this story.