Despite its high frequency and clinical relevance, the pathogenesis of canine pyometra remains poorly understood. The most accepted hypothesis is that bacteria involved ascend from the intestinal tract, causing the uterine infection. Extraintestinal pathogenic Escherichia coli (ExPEC) is the most frequent pathogen in canine pyometra, accounting for 57–100% of cases. The aim of the present study was to determine the frequency of phylogenetic groups and virulence factors in E. coli strains isolated from the uterine and rectal swabs of bitches with pyometra (n = 72) and from rectal swabs from healthy bitches fed commercial dry feed (n = 53) or a raw meat-based diet (RMBD; n = 38). A total of 512 strains of E. coli were isolated and divided into five categories according to the origin of the sample: 120 isolates from the uterine content of dogs with E. coli pyometra, 102 from the feces of bitches with E. coli pyometra, 75 from the feces of bitches without E. coli pyometra, 130 feces samples from healthy dogs fed commercial feed, and 85 feces samples from healthy dogs fed a raw meat-based diet. E. coli strains belonging to the B2 phylogroup and positive for virulence factor genes associated with adhesion (fimbriae type P [papC]) and production of toxins (α-hemolysin [hlyA] and uropathogenic specific protein [usp]) predominated in the uterine content and rectal swabs of bitches with E. coli pyometra. Interestingly, a lower growth rate of E. coli from the B2 phylogroup was observed in dogs fed a RMBD than in those fed commercial dry feed. The present study suggests that intestinal colonization by certain types of E. coli could be a risk factor for the occurrence of E. coli pyometra in bitches and that diet can influence intestinal colonization by such strains.