The U's broke the deadlock in first-half stoppage-time when Billy Clifford collected possession midway inside his own half before unleashing a fine right-footed shot that flew into the top corner from 25 yards.
Colchester defender Magnus Okuonghae had earlier sent a free header wide and Yeovil goalkeeper Marek Stech had to tip over Clifford's long-range strike, while U's keeper Sam Walker pushed away Ed Upson's close-range effort at the other end.
Jabo Ibehre's shot on the turn was pushed away by Stech in the seconds that followed after half-time and Gavin Massey's long-range strike flew just over as Colchester pressed for a second goal.
They got one just after the hour-mark when Freddie Sears steadied himself in the penalty area before drilling home after Bradley Garmston had done superbly to race to the byline and pick him out.
Walker pushed away a header from Yeovil defender Dan Burn late on, but Colchester secured a crucial win.