Catalysis of the reaction: acetoacetyl-CoA + acetyl-CoA + H2O = (S)-3-hydroxy-3-methylglutaryl-CoA + CoA + H+.
acetyl-CoA:acetoacetyl-CoA C-acetyltransferase (thioester-hydrolysing, carboxymethyl-forming)