Tanui held off his compatriot Ezekiel Bitok to win in 2hr 9min 16sec. Ndeti finished third.
At 24 miles Ndeti had dropped 90 yards behind Tanui and Bitok, who was running in his first marathon. It was the sixth consecutive victory for Kenya, who use the event for their Olympic trials.
In the women's race, Uta Pippig of Germany overtook the Kenyan Tegla Loroupe with just a mile remaining to capture a third consecutive Boston victory in 2:27:12.
Pippig became the first woman to win Boston three years in a row since women were officially allowed in the race in 1972. Pippig was rumoured to be ill before the race, but put in strong finish as Loroupe, who has twice won the New York Marathon, faded.
The American Jean Driscoll won an unprecedented seventh consecutive wheelchair race in 1:52:54 and the 1994 champion Heinz Frei, of Switzerland, took the men's wheelchair division, leading a record field across the finish line in 1:30:11.Reuse content