C.C. “Bud” Baxter is a lonely office drudge at a national insurance corporation in a high-rise building in New York City. In order to climb the corporate ladder, Bud allows four company managers to take turns borrowing his Upper West Side apartment for their various extramarital liaisons, which are so noisy that his neighbors assume that Bud is a playboy bringing home a different woman every night.
The four managers write glowing reports about Bud, who hopes for a promotion from the personnel director, Jeff D. Sheldrake. Sheldrake does promote Bud, but he knows why they were so enthusiastic and demands exclusive privileges to borrow the apartment himself, starting that same night. As compensation for such short notice, he gives Baxter two tickets to The Music Man.
After work, Bud catches Fran Kubelik, an elevator operator he has had his eye on, and asks her to go to the musical with him. She accepts, but first has to meet a former fling. He is Sheldrake, who convinces her that he is about to divorce his wife for her. They go to Bud’s apartment as Bud waits forlornly outside the theater.
Later, at the company’s raucous Christmas party, Sheldrake’s secretary Miss Olsen (Edie Adams) drunkenly tells Fran that Fran is one of many female employees Sheldrake has seduced into affairs with the promise of divorcing his wife, including Miss Olsen herself. At Bud’s apartment, Fran confronts Sheldrake, upset with herself for believing his lies. Sheldrake maintains that he genuinely loves her, but then leaves to return to his suburban family as usual.
Meanwhile, Bud accidentally learns about Sheldrake and Fran when he notices Fran’s broken hand mirror, the same one which he returned to Sheldrake. Heartbroken, he lets himself be picked up by a woman at a local bar. When they arrive at his apartment, he is shocked to find Fran in his bed, fully clothed and unconscious from an intentional overdose of his sleeping pills. He sends his pick-up away and enlists the help of his neighbor, Dr. Dreyfuss, to revive Fran without notifying the authorities. To protect his job, Bud takes advantage of his playboy reputation, letting Dreyfuss believe Fran had attempted suicide after a lovers’ quarrel with him.
Fran spends two days recuperating there, while Bud tries entertaining and distracting her from any suicidal thoughts. He tells her he once attempted suicide himself. They begin playing gin rummy. Bud dissuades her from phoning her family until her head is clear. During this period one of the executives arrives with a woman; Bud sends them away, but the man sees Fran. Then Fran’s brother-in-law Karl Matuschka comes to the office looking for her. Resenting Bud for denying them access to his apartment, the executives direct Karl there. When Bud again takes responsibility for Fran’s actions, Karl punches him. Fran kisses Bud on the forehead for not revealing her affair with Sheldrake and, sensing that she now cares for him, Bud smiles and says it “didn’t hurt a bit.”
Sheldrake rewards Bud with a further promotion, and fires Miss Olsen for what she told Fran. However, Miss Olsen retaliates by telling Sheldrake’s wife, who promptly throws him out. Sheldrake moves into a room at his athletic club, but now figures that he can string Fran along while he enjoys his newfound bachelorhood.
But when Sheldrake asks Bud for the key to the apartment, Bud instead gives back the key to the executive washroom and quits the firm. That night at a New Year’s Eve party, Sheldrake indignantly tells Fran about this. She finally realizes that Bud is the man who truly loves her. She runs to his apartment, but at the door, she hears a loud noise like a gunshot. Fearing he has attempted suicide again, Fran pounds on the door until Bud opens it, holding an overflowing bottle of champagne which was the source of the noise. Bud has been packing, planning to find a new job and a new home, but is surprised and delighted to see her. Fran insists on resuming their gin rummy game, telling Bud that she is now free as well. He declares his love for her, and she replies lovingly, “Shut up and deal.”