"I've been chewing on this Nicorette, which tastes like you're chewing on ground pepper - but it does help," the Democratic candidate said in an interview that aired Thursday on "The Ellen DeGeneres Show."
His wife, Michelle, had used his smoking as leverage when the two were discussing whether he should run for president. She would agree only if Obama agreed to give up smoking.
"I had been sneaking three cigarettes, four cigarettes a day for a while, and she said if you're going to do this you've got to stop - precisely because the stress was going to increase, and it'll just get worse," Obama said. "So that's an example of my wife making me a better man once again."
The Illinois senator told talk show host Ellen DeGeneres that dancing on her show had helped him win voters.
"I just want to say that we were kind of in a slump until I was dancing on the show," he joked, referring to his appearance on her show last fall. "My poll numbers skyrocketed after that. Everybody saw me bust a move on Ellen - that's all it took."
On Monday, DeGeneres showed up by satellite at a fundraiser foron the campus of George Washington University in the District of Columbia.
DeGeneres told Obama that she and many other voters find the two Democratic candidates appealing.
"I really like you. I really like Hillary. And I think a lot of people feel the same way," she said. "Why vote for you?"
Obama said he can unite the country.
"I think I have a better chance at getting Democrats and independents and Republicans to come together and put aside some partisan bickering that has been going on for a long time now that the Clintons were involved in," he said.