Aides to Mrs. Clinton say they had always planned for an extended and cash-hungry primary, hoping to avoid a repeat of her 2008 blunder, when she had to lend her campaign millions of dollars to stay afloat after running short of primary cash. Much of Mrs. Clinton’s spending has gone to build long-term capabilities with data, in the field and prospecting for small donors that will pay continuing dividends through an increasingly likely fall campaign, they said, and Mrs. Clinton remained on budget for the primary race. Her campaign had $30.8 million on hand.

“We head into the homestretch of the primary in strong financial shape with the resources we need to continue to run a competitive race through the end of the primary and the road ahead,” said Robby Mook, Mrs. Clinton’s campaign manager.

But as the Clinton campaign and its allies see the challenge from Mr. Sanders fading and have grown more comfortable with their delegate lead, they are shifting some of their attention away from the primary and looking toward the general election, mapping out fund-raising plans and sharpening their message.

The campaign has begun discussions with senior “bundlers” — donors who volunteer to collect checks from dozens of other donors — to step up contributions to the Hillary Victory Committee, a joint fund-raising effort with the Democratic National Committee and many state Democratic organizations.