Anaplasmosis is a significant tick-borne disease (TBDs) caused by Anaplasma that affecting ruminant health and production worldwide. This study aimed to identify Anaplasma spp. infection using molecular as a fast diagnostic tool, perform a phylogenetic analysis and evaluate associated risk factors for combating Anaplasma spp. infection in small-scale livestock farms in Thailand. Total 963 blood samples from ruminants were collected from 125 farms across 4 regions of Thailand. Molecular diagnosis of Anaplasma spp. targeted the msp4 gene using conventional polymerase chain reaction (PCR) was performed and reported to the farmers within 14 days. Positive PCR products were purified, sequenced, and analysed the phylogenetic. Associated risk factor evaluations were conducted using R software. The overall prevalence of Anaplasma spp. infection in ruminants was 26.90%. The highest prevalence was observed in bullfighting cattle (47.06%), followed by beef cattle (35.75%), dairy cattle (21.73%), and goats (6.67%), with no infection in buffalo. Regionally, the Northern region had the highest prevalence (49.01%), followed by the Southern (25.88%), Central (22.01%), and Northeastern (13.81%) regions. Anaplasma spp. was commonly detected in Phrae, Chiang Rai, and Tak provinces. Sequencing confirmed A. marginale 99.64% to 99.76% identity to sequences in GenBank. Risk factors associated with A. marginale infection were history of TBDs on farm, animal illnesses, responsible person for treatment, and improper faeces removal practices. This study revealed a moderate to high Anaplasma infection across four regions. These findings underscore the need for enhanced tick control measures on farms, should be strictly implemented and promoted to reduce disease prevalence.