Gates and retired Gen. James Jones bring years of experience to the Cabinet of a 47-year-old commander in chief with a relatively thin foreign policy resume.
Obama, who rolled out the key components of his economic team this week, plans to announce his foreign policy braintrust after the Thanksgiving holiday.
Gates, who has served as President George W. Bush's defense chief for two years, will remain in the Cabinet for some time, probably a year, according to an official familiar with discussions between the two men. A Democratic official said Jones was Obama's pick to head the National Security Council, the part of the White House structure that deals with foreign policy.
The officials spoke on condition of anonymity because Obama has not authorized anybody to discuss the deliberations.
Gates, a moderate with long-standing ties to Republican administrations and the Bush family, would fulfill an Obama pledge to include a Republican in his Cabinet.
Retaining Gates provides stability for a stretched military fighting two wars during the turbulent changeover in administrations. Gates once said it was inconceivable that he would stay on past the close of Bush's term on Jan. 20.
But the 65-year-old former spymaster had recently turned mum in public on the circumstances under which he would stay, even briefly, in an Obama administration.
Keeping Gates might afford Obama a sort of extended transition, in which critical military issues are left in trusted hands while Obama focuses most intensely on the financial crisis.
This is the first wartime presidential transition since 1968, when the Vietnam War was under way, and there is extra concern about security vulnerabilities during this handover.
Gates has run the department since December 2006, reluctantly giving up his post as president of Texas A&M University to replace Donald H. Rumsfeld when the Iraq war seemed to be failing.
He has gained a reputation as a steady pragmatist, but Gates' resume as a government policymaker is not untarnished.
During his 1991 confirmation hearings to be CIA director, Gates was criticized for missing clues about the impending fall of the Soviet Union and for politicizing Cold War intelligence. Those two complaints -- misreading intelligence and using it selectively -- have also dogged the Bush administration in its Iraq policy.
But supporters see Gates as a seasoned policymaker who climbed the CIA bureaucracy from an entry-level position to become director under President George H.W. Bush. He also served on his National Security Council, as he had for Presidents Carter and Reagan.
Bush noted that Gates helped lead U.S. efforts to drive the Soviets out of Afghanistan in the 1980s while at the CIA and was deputy national security adviser during Operation Desert Storm, the first U.S.-led invasion of Iraq.
He was part of the 2006 Iraq Study Group, a bipartisan panel led by former Secretary of State James Baker III and former Rep. Lee Hamilton that was asked to help chart a new course in the flagging war.
A native of Kansas, Gates joined the CIA in 1966. By 1987, he became acting CIA director when William Casey was terminally ill with cancer.
Questions were raised about Gates' knowledge of the Iran-Contra arms and money affair, and he withdrew from consideration to take over the CIA permanently. Yet he stayed on as deputy director.
Then-national security adviser Brent Scowcroft, who has been a critic of the younger Bush's policies, asked Gates to be his deputy in 1989 during the administration of Bush's father. The elder President Bush asked Gates to run the CIA two years later.
Gates won confirmation, but only after hearings in which he was accused by CIA officials of manipulating intelligence as a senior analyst in the 1980s.
Melvin Goodman, a former CIA division chief for Soviet affairs, testified that Gates politicized the intelligence on Iran, Nicaragua, Afghanistan and the Soviet Union.
Gates took a much lower profile when he left the CIA and the government in 1993. He joined corporate boards and wrote a memoir, "From the Shadows: The Ultimate Insider's Story of Five Presidents and How They Won the Cold War."
Gates is a close friend of the Bush family. He was interim dean of the George Bush School of Government and Public Service at Texas A&M and became the university's president in 2002. The school is home to the elder Bush's presidential library.