NIAMEY, Niger—The U.S. is reducing the presence of American commandos on Africa’s front lines, a move U.S. officers believe will make troops less vulnerable to the type of militant attack that left four U.S. soldiers dead in this West African country last fall.

American Green Berets, Navy SEALs and Marine special operators serving as advisers to African forces will largely stay closer to the rear, working from command centers and battalion headquarters, rather than accompanying African troops on hazardous operations against...