going to need napoleon's help:
Step one: Spain does not trade Louisiana to France for Parma. Spain is constantly cowed by the US, so they leave the mississippi open to US navigation so the US has no reason to buy New Orleans, which is all it set out to do. Alternatively, you could have the US buy NO or take it by force from Spain. IMO, the Louisiana Purchase really added fuel to the fire of the notion of manifest destiny. confine it to NO removes a lot of this fuel. yes, US settlers are going to move west, but there'll be less of this grand notion that the US is destined to go coast to coast.
Step two: need a stronger Mexico. the strife of the independence war and the civil wars that followed put a hurting on the country. Maybe Iturbide stays loyal to Spain. Maybe Napoleon doesn't invade Spain, and the whole sudden impetus for the colonies looking for freedom doesn't explode, and Spain is a stronger country during the critical decades (it would help immensely if Ferdinand falls down a flight of stairs in 1800. would really help if he landed on Godoy). Maybe one of the Bourbon princes accepts a kingship. Maybe the royal family makes good on their escape to Mexico instead of handing the selves over for imprisonment by Nap. Maybe an independent Mexico finds independence in a less bloody manner and is better governed from the start. Knowing the OTL state of governing bodies of both Spain and Mexico in this timeframe, these options are highly unlikely, but they're not impossible. Bottom line is that Mexico had plenty of potential to be a strong country, but it imploded in the first half of the 19th century. a stronger, better Mexico means the US is not automatically winning any wars. OTL, the war was started out of greed over lands of what was seen as an easy target. if the target isn't so easy, the US may not be so greedy.If that's the case, bye bye west coast.