Sun Microsystems said it plans to buy StorageTek for $4.1 billion in cash or about $37 per share. The deal has been approved by both boards, according to a statement issued Thursday morning.