If you don't mind a pre-war PoD, have President Herrera's offer of peaceable border agreement be accepted. The US gets Texas, accepts the Mexican claim to the Nueces River boundary, and purchases California and New Mexico north of the 37th parallel.
Otherwise, Nicholas Trist was instructed to go for more territory than the US historically got. I've seen in other threads on this site that Polk wanted Chihuahua, Sonora, Nuevo Leone, Tamaulipas, and Coahuil, but that might have just been Polk specifically who desired that. The Democrats on the whole were urging for something similar to what the US got, BUT were also very explicit in wanting Baja California.
An issue for Polk would be that by the time of negotiations, his time as President was coming to a close. It'd take a month recall Trist, another month to send somebody else, some time to negotiate a different line, and then another month for the treaty to get to Congress. The House ratified it OTL in March of 1848 and the Senate OTL only ratified the treaty in May of 1848. Maybe Polk could have gotten a better treaty for the US and had it ratified before his time as president was up, but OTL he reluctantly decided to accept Trist's negotiaton.
So, just have Trist go a bit more rogue. Trist extends the boundary north along the Colorado River from Yuma and at the 35th parallel the boundary is a straight line from the Pacific to the Colorado. Very reluctantly, Polk goes along with it. Meanwhile without LA or SD, there's no west coast for a southern railroad to connect to (thus defeating the point of a TTL Gadsden Purchase).