Many predatory coccinellids conflict with hemipteran tending ants, because they both use hemipterans as resources. Lady beetles are important in the ecology of ants and their reciprocal relationship with hemipterans. Volatiles released by lady beetles have diverse biological significance in intraspecific communication, attraction, and aggregation. However, whether the semiochemicals from lady beetles influence the sympatric members, such as aphids and ants, is still obscure. Sugarcane aphids Melanaphis sacchari was closely associated with honeydew collecting ants and coccinellid predators. Herein, we investigated the behavioral and electrophysiological responses of M. sacchari and their attending red imported fire ants, Solenopsis invicta, to an alkaloid, 2,4,6-trimethylpyridine (TMP) from the pink-spotted lady beetle Coleomegilla maculata. The response of C. maculata to this alkaloid was also evaluated. The results showed that TMP elicited significant electroantennogram (EAG) responses in M. sacchari, S. invicta, and C. maculata. In addition, it triggered significant preference and aggregation in both C. maculata males and females at 100 μg/μL, while induced a strong avoidance in M. sacchari. It significantly decreased the digging and residing preference of S. invicta workers at high concentration, but showed certain attractiveness to workers at a lower concentration. Moreover, TMP inhibited aphid-tending efficiency of S. invicta thereby curbing the benefits to M. sacchari. The findings provide important evidence that TMP is a pheromone in C. maculata and a semiochemical to both S. invicta and M. sacchari. It may affect the mutualistic interactions between S. invicta and M. sacchari by mediating the behaviors of both species.