Twitter Inc. and activist hedge fund Elliott Management Corp. have agreed to a truce that will shake up the social-media company’s board but leave Chief Executive Jack Dorsey in place.

The deal halts what was shaping up as one of the highest profile clashes between an activist investor to oust a founder of a high-profile tech company.

The...