Catalyzes the hydrolysis of acyl-CoAs into free fatty acids and coenzyme A (CoASH), regulating their respective intracellular levels. Has acyl-CoA thioesterase activity towards medium (C12) and long-chain (C18) fatty acyl-CoA substrates. Can also hydrolyze 3-hydroxyphenylacetyl-CoA and 3,4-dihydroxyphenylacetyl-CoA (in vitro). May play a role in controlling adaptive thermogenesis