Background and purpose - The correct diagnosis of prosthetic joint infection (PJI) can be difficult because bacteria form a biofilm on the surface of the implant. The sensitivity of culture from sonication fluid is better than that from periprosthetic tissue, but no comparison studies using molecular methods on a large scale have been performed. We assessed whether periprosthetic tissue or sonication fluid should be used for molecular analysis. Patients and methods - Implant and tissue samples were retrieved from 87 patients who underwent revision operation of total knee or total hip arthroplasty. Both sample types were analyzed using broad-range (BR-) PCR targeting the 16S rRNA gene. The results were evaluated based on the definition of periprosthetic joint infection from the Workgroup of the Musculoskeletal Infection Society. Results - PJI was diagnosed in 29 patients, whereas aseptic failure was diagnosed in 58 patients. Analysis of sonication fluid using BR-PCR detected bacteria in 27 patients, whereas analysis of periprosthetic tissue by BR-PCR detected bacteria in 22 patients. In 6 of 7 patients in whom BR-PCR analysis of periprosthetic tissue was negative, low-virulence bacteria were present. The sensitivity and specificity values for periprosthetic tissue were 76% and 93%, respectively, and the sensitivity and specificity values for sonication fluid were 95% and 97%. Interpretation - Our results suggest that sonication fluid may be a more appropriate sample than periprosthetic tissue for BR-PCR analysis in patients with PJI. However, further investigation is required to improve detection of bacteria in patients with so-called aseptic failure.