You can either do the Masuda Method or Dark Grass Wild Encounters. But since Masuda Method is rarely available, Wild Encounters are probably going to be your best option. In both (inner) Pinwheel Forest and Lostlorn Forest, the Dark Grass has a 35% Petilil chance per encounter in the Dark Grass, which accelerates the number of Pokémon seen per hour because of the chance for double battles. Additionally, if you want to maximize your chances of getting Petilil in particular, you can use the repel trick with a Lv 25, which prevents Tranquill and Whirlipede from appearing in Pinwheel Forest (resulting in a 50% Petilil encounter chance) and prevents Venipede from appearing in Lostlorn Forest (resulting in a ~41% Petilil encounter chance). For the best chance of getting a shiny Petilil via Wild Encounters, hunt in the Dark Grass of inner Pinwheel Forest, leading the party with a Lv 25 while repelling.