The parties, however, said they would not field candidates in Amethi and Rae Bareli, represented by Congress president Rahul Gandhi and UPA chairperson Sonia Gandhi. They also left two seats, out of 80, for smaller allies.
Making the announcement at a joint press conference with SP president Akhilesh Yadav here, BSP chief Mayawati said, "This...will rob 'guru-chela' -- Prime Minister Narendra Modi and BJP president Amit Shah -- of their sleep."
"I have full confidence that just as our alliance defeated the BJP in the Lok Sabha bypolls, we will crush the saffron party in the general elections," she said, referring to the BJP's defeat in Phulpur, Gorakhpur and Kairana parliamentary bypolls.
Explaining why the Congress was not included in the alliance, she said that during the Congress rule over the years, poverty, unemployment and corruption grew and there had been scams in various defence deals.
She also said that in case of a tie-up with the Congress in the past, the party did not benefit.
"In the past I have seen that our votes get transferred to the Congress, but not vice-versa. We do not gain from alliance with Congress, whereas vote transfer is perfect in SP-BSP tie-up," Mayawati said.
Drawing a parallel between the BJP and the Congress, Mayawati said the Congress had imposed the Emergency while the BJP is responsible for an undeclared Emergency.
The joint press conference was held at a posh hotel here after top leadership of both the parties had met in New Delhi recently to discuss broad parameters of the alliance to take on the BJP unitedly in the Lok Sabha elections.
In 2014, the BJP had won 71 seats in Uttar Pradesh while its ally Apna Dal bagged two. The Samajwadi Party won 5 seats and the Congress two, while the BSP drew a blank.
Reacting to the development, senior BJP leader and Union minister Ravi Shankar Prasad said, "The SP and BSP have allied neither for the country nor for Uttar Pradesh, but for their survival. They know they cannot fight Modi on their own and their opposition to him is the sole base of their alliance."