The aim of the present study was to investigate the inhibitory effect of compound cantharides capsules (CCCs) on the viability and apoptosis of human gastric cancer cell lines, BGC-823 and SGC-7901, and to detect its regulation of gene expression levels, as well as its inhibition mechanisms. Each cell line was grouped into a control group, CCC serum group, 5-fluorouracil (5-FU) group, combination therapy group (CCC serum + 5-FU) and serum control group. Growth curves were measured and flow cytometry was used to detect cell apoptosis and cell viability. The mRNA expression level of proliferation-related C-MYC and p53 genes were assayed by reverse transcription-quantitative polymerase chain reaction. Protein phosphorylation levels of proliferating cell nuclear antigen, p38 mitogen-activated protein kinase, extracellular signal-related kinase 1/2, c-Jun N-terminal kinase (JNK) and IκB were assayed by western blotting. The combined CCC serum and 5-FU group exhibited a higher inhibition rate in both cell lines and CCC serum therapy demonstrated a similar effect to 5-FU treatment, as demonstrated in the MTT and cell growth assay. Combined therapy significantly decreased the C-MYC mRNA expression levels and increased p53 mRNA expression levels (P<0.05). Combined therapy of 5-FU and CCC was more significant compared with CCC serum or 5-FU only (P<0.05). P38 and JNK-related protein phosphorylation are involved in apoptosis initiated by CCC combined 5-FU therapy. Combined therapy was able to significantly inhibit human gastric cancer cell growth (P<0.05), and advance cell apoptosis compared with CCC serum only. CCC serum resulted in downregulation of the c-Myc gene and upregulation of the p53 gene. p38 and JNK-related protein phosphorylation is involved in the inhibition of cell viability and apoptosis of human gastric cancer cell lines.