Heat the oil in a large skillet or wok over medium-high heat until it shimmers. Add the shrimp in a single layer and cook for about a minute on each side, just until they turn pink and opaque. Remove them from the pan right away so they don't overcook while you work on the rest.
In the same pan, add a touch more oil if it looks dry, then toss in the diced shallot, the white parts of the green onion, minced garlic, and Thai chilies if you're using them. Stir constantly for about a minute or two until everything smells fragrant. This step builds the flavor base for the whole dish.
Push the aromatics to one side of the pan to make some room. Pour the beaten eggs into the empty space and let them sit for a few seconds before scrambling gently. Once they're just set but still soft, mix them together with the aromatics already in the pan.
Break up any clumps in your cooked rice with your hands or a spoon before adding it to the pan. Pour in the soy sauce, oyster sauce, salt, pepper, and sugar, then toss everything together over high heat. Keep stirring until every grain of rice looks evenly coated in sauce.
Return the cooked shrimp to the pan along with the sesame oil and Thai basil leaves. Stir everything together just until the basil wilts slightly and turns a darker green. This usually only takes about thirty seconds, so keep an eye on it.
Spread the rice out in an even layer and let it sit undisturbed for a minute or two before stirring again. This gives you those slightly crispy, golden bits that make fried rice taste like it came from a restaurant. Repeat this once more if you want extra texture.